@nexly/web 0.12.0 → 0.13.0
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 +23 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -32,4 +32,26 @@ const stopEngagement = client.startEngagement()
|
|
|
32
32
|
- `startEngagementTracking(creds)` — standalone engagement attach (scroll / click / focus / visibility / keepalive).
|
|
33
33
|
- `sendBeaconCollect(input)` — raw `sendBeacon` helper.
|
|
34
34
|
|
|
35
|
-
For React bindings use [`@nexly/react-web`](https://www.npmjs.com/package/@nexly/react-web); for Next.js App Router use [`@nexly/next`](https://www.npmjs.com/package/@nexly/next); for React Native use [`@nexly/react-native`](https://www.npmjs.com/package/@nexly/react-native).
|
|
35
|
+
For React bindings use [`@nexly/react-web`](https://www.npmjs.com/package/@nexly/react-web); for Next.js App Router use [`@nexly/next`](https://www.npmjs.com/package/@nexly/next); for React Native use [`@nexly/react-native`](https://www.npmjs.com/package/@nexly/react-native); for Node.js servers use [`@nexly/node`](https://www.npmjs.com/package/@nexly/node).
|
|
36
|
+
|
|
37
|
+
## Linking backend events to this visitor
|
|
38
|
+
|
|
39
|
+
If you also emit server-side events with [`@nexly/node`](https://www.npmjs.com/package/@nexly/node) and want them to show up on the same user timeline as browser activity, forward the browser's Nexly visitor id to your backend once (on sign-up / login), persist it next to your own user record, and pass it through in `context` when emitting backend events.
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { getVisitorId, getSessionId } from '@nexly/web'
|
|
43
|
+
|
|
44
|
+
// once per signed-in user — send to your own backend
|
|
45
|
+
await fetch('/api/link-visitor', {
|
|
46
|
+
method: 'POST',
|
|
47
|
+
headers: { 'Content-Type': 'application/json' },
|
|
48
|
+
body: JSON.stringify({
|
|
49
|
+
visitorId: getVisitorId(),
|
|
50
|
+
sessionId: getSessionId(), // optional
|
|
51
|
+
}),
|
|
52
|
+
})
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`getVisitorId()` reads the persistent anonymous id Nexly stores in `localStorage`; `getSessionId()` reads the 30-minute tab session id from `sessionStorage`. Both are plain strings, safe to call from anywhere.
|
|
56
|
+
|
|
57
|
+
See the full recipe (backend storage + emitting linked events) in the [`@nexly/node` README](https://www.npmjs.com/package/@nexly/node).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexly/web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Nexly browser ingest SDK: sendBeacon transport, DOM metadata, engagement listeners on top of @nexly/core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"node": ">=20"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@nexly/core": "0.
|
|
41
|
+
"@nexly/core": "0.13.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"typescript": "~6.0.2"
|