@litemetrics/react-native 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +83 -0
  2. package/package.json +11 -3
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # @litemetrics/react-native
2
+
3
+ React Native / Expo bindings for Litemetrics analytics. Provider, hooks, and automatic navigation tracking.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @litemetrics/react-native
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```tsx
14
+ import { LitemetricsProvider } from '@litemetrics/react-native';
15
+
16
+ function App() {
17
+ return (
18
+ <LitemetricsProvider
19
+ siteId="your-site-id"
20
+ endpoint="https://your-server.com/api/collect"
21
+ >
22
+ <YourApp />
23
+ </LitemetricsProvider>
24
+ );
25
+ }
26
+ ```
27
+
28
+ ## Navigation Tracking
29
+
30
+ Automatically track screen views with React Navigation:
31
+
32
+ ```tsx
33
+ import { useNavigationTracking } from '@litemetrics/react-native';
34
+ import { NavigationContainer } from '@react-navigation/native';
35
+
36
+ function AppNavigator() {
37
+ const navigationRef = useNavigationTracking();
38
+
39
+ return (
40
+ <NavigationContainer ref={navigationRef}>
41
+ {/* Your screens */}
42
+ </NavigationContainer>
43
+ );
44
+ }
45
+ ```
46
+
47
+ ## Hooks
48
+
49
+ ### `useLitemetrics`
50
+
51
+ Access the tracker instance for custom events and identification:
52
+
53
+ ```tsx
54
+ import { useLitemetrics } from '@litemetrics/react-native';
55
+
56
+ function PurchaseButton({ product }) {
57
+ const tracker = useLitemetrics();
58
+
59
+ return (
60
+ <Button
61
+ title="Buy"
62
+ onPress={() => tracker.track('Purchase', { product: product.name })}
63
+ />
64
+ );
65
+ }
66
+ ```
67
+
68
+ ### `useAppStateTracking`
69
+
70
+ Track app foreground/background transitions:
71
+
72
+ ```tsx
73
+ import { useAppStateTracking } from '@litemetrics/react-native';
74
+
75
+ function App() {
76
+ useAppStateTracking();
77
+ return <YourApp />;
78
+ }
79
+ ```
80
+
81
+ ## License
82
+
83
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litemetrics/react-native",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "React Native / Expo bindings for Litemetrics analytics",
5
5
  "license": "MIT",
6
6
  "author": "Metehan Kurucu",
@@ -9,7 +9,13 @@
9
9
  "url": "https://github.com/metehankurucu/litemetrics",
10
10
  "directory": "packages/react-native"
11
11
  },
12
- "keywords": ["analytics", "litemetrics", "react-native", "expo", "tracking"],
12
+ "keywords": [
13
+ "analytics",
14
+ "litemetrics",
15
+ "react-native",
16
+ "expo",
17
+ "tracking"
18
+ ],
13
19
  "type": "module",
14
20
  "main": "./dist/index.cjs",
15
21
  "module": "./dist/index.js",
@@ -21,7 +27,9 @@
21
27
  "require": "./dist/index.cjs"
22
28
  }
23
29
  },
24
- "files": ["dist"],
30
+ "files": [
31
+ "dist"
32
+ ],
25
33
  "publishConfig": {
26
34
  "access": "public"
27
35
  },