@metrone-io/react 1.1.0 → 1.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.
- package/README.md +54 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# @metrone-io/react
|
|
2
|
+
|
|
3
|
+
React bindings for [Metrone](https://metrone.io) analytics.
|
|
4
|
+
|
|
5
|
+
Provider component, hooks, and HOC for integrating Metrone into React and Next.js applications with automatic route tracking.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @metrone-io/react @metrone-io/sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
import { MetroneProvider, useMetrone } from '@metrone-io/react'
|
|
17
|
+
|
|
18
|
+
function App() {
|
|
19
|
+
return (
|
|
20
|
+
<MetroneProvider
|
|
21
|
+
config={{
|
|
22
|
+
apiKey: 'metrone_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
|
23
|
+
endpoint: '/api/analytics/events'
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
<MyApp />
|
|
27
|
+
</MetroneProvider>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function MyComponent() {
|
|
32
|
+
const { trackEvent, trackConversion } = useMetrone()
|
|
33
|
+
return (
|
|
34
|
+
<button onClick={() => trackEvent('button_click', { button_id: 'cta' })}>
|
|
35
|
+
Click Me
|
|
36
|
+
</button>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## API
|
|
42
|
+
|
|
43
|
+
- **`MetroneProvider`** — Context provider, initializes the SDK
|
|
44
|
+
- **`useMetrone()`** — Hook returning `{ trackEvent, trackConversion, metrone }`
|
|
45
|
+
- **`withMetrone(Component)`** — HOC injecting Metrone props
|
|
46
|
+
- **Automatic route tracking** — Pageviews on route changes
|
|
47
|
+
|
|
48
|
+
## Documentation
|
|
49
|
+
|
|
50
|
+
[metrone.io/docs](https://metrone.io/docs)
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
[MIT](../../LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metrone-io/react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Metrone React integration - Privacy-first analytics for React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"repository": {
|
|
35
35
|
"type": "git",
|
|
36
|
-
"url": "https://github.com/metrone/
|
|
36
|
+
"url": "https://github.com/metrone-io/sdks.git",
|
|
37
37
|
"directory": "packages/react"
|
|
38
38
|
},
|
|
39
39
|
"bugs": {
|
|
40
|
-
"url": "https://github.com/metrone/
|
|
40
|
+
"url": "https://github.com/metrone-io/sdks/issues"
|
|
41
41
|
},
|
|
42
42
|
"homepage": "https://metrone.io",
|
|
43
43
|
"engines": {
|