@nexly/react-native 0.15.2 → 0.15.4

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 +35 -7
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -31,10 +31,6 @@ export default function App() {
31
31
  function Root() {
32
32
  const client = useNexlyClient()
33
33
 
34
- useEffect(() => {
35
- client?.screenview('Home')
36
- }, [client])
37
-
38
34
  return (
39
35
  <Button
40
36
  title="Upgrade"
@@ -44,12 +40,23 @@ function Root() {
44
40
  }
45
41
  ```
46
42
 
47
- ## Screens / paths
43
+ ## Screen views and paths
48
44
 
49
- React Native has no URL, so Nexly uses a manual **screen name** instead:
45
+ React Native has no URL, so Nexly uses a manual **screen name** as the path:
50
46
 
51
47
  - `client.setScreen('Settings')` — updates the screen used as `path` on future events.
52
- - `client.screenview('Settings')` — sets the screen and sends a `pageview`.
48
+ - `client.screenview('Settings')` — records that the user viewed a new screen.
49
+
50
+ On the ingest wire, a screen view is stored as a `pageview` event with
51
+ `context.path` set to the screen name. That keeps mobile screens in the same
52
+ Pages dashboard, filters, and session metrics as web routes, while the React
53
+ Native API still uses `screenview()` because that is the vocabulary app
54
+ developers expect.
55
+
56
+ Call `screenview()` only when the user actually views a different screen or
57
+ route. Do not use it for button taps, form input, tab content changes inside the
58
+ same screen, or other interactions. Send those with `client.event(...)` instead;
59
+ they still carry the current screen as `path` and are counted as engagement.
53
60
 
54
61
  Hook it up to your router of choice. Example with `@react-navigation/native`:
55
62
 
@@ -64,6 +71,10 @@ Hook it up to your router of choice. Example with `@react-navigation/native`:
64
71
  </NavigationContainer>
65
72
  ```
66
73
 
74
+ If you pass `initialScreen`, you do not need to send an extra `screenview()` for
75
+ that same screen during the first render. Send the first manual `screenview()`
76
+ from your navigator when it reports a route change.
77
+
67
78
  ## Engagement
68
79
 
69
80
  `autoEngagement` attaches an `AppState` listener that:
@@ -75,3 +86,20 @@ Hook it up to your router of choice. Example with `@react-navigation/native`:
75
86
  No scroll/click tracking (those are DOM-only); if you want tap analytics, send custom `engagement` events yourself.
76
87
 
77
88
  `startEngagement()` is idempotent — calling it again stops the previous subscription first, so Fast Refresh or double-mounts cannot produce duplicate listeners.
89
+
90
+ ## Dashboard setup
91
+
92
+ Enable Mobile apps in your app's Ingest settings in the
93
+ [Nexly dashboard](https://app.nexly.to) before sending native events. This
94
+ allows React Native traffic from the package's synthetic origin and makes React
95
+ Native sources visible in Technology analytics.
96
+
97
+ Native clients report as:
98
+
99
+ - `rn-ios` for iOS and other Apple native runtimes,
100
+ - `rn-android` for Android,
101
+ - `rn-web` when running through React Native Web.
102
+
103
+ In Technology analytics, native React Native traffic is labelled as React
104
+ Native with the appropriate OS and mobile device type. React Native Web uses the
105
+ browser's normal web metadata.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexly/react-native",
3
- "version": "0.15.2",
3
+ "version": "0.15.4",
4
4
  "description": "React Native bindings for Nexly: fetch transport, AsyncStorage IDs, AppState engagement on top of @nexly/core",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -43,7 +43,7 @@
43
43
  "react-native": ">=0.72.0"
44
44
  },
45
45
  "dependencies": {
46
- "@nexly/core": "0.15.2"
46
+ "@nexly/core": "0.15.4"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@react-native-async-storage/async-storage": "^2.1.2",