@oneuptime/react-native-replay 15.0.0 → 17.0.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 CHANGED
@@ -142,6 +142,7 @@ OneUptimeReplay.identify("support-user-42", {
142
142
  OneUptimeReplay.setTags({ build: "2026.09.13", experiment: "checkout-b" });
143
143
  OneUptimeReplay.addTag("region", "eu-west");
144
144
  OneUptimeReplay.track("checkout_opened", { cartSize: 3 });
145
+ OneUptimeReplay.metric("cart.value", 42.5, { currency: "EUR" });
145
146
 
146
147
  // Call from the navigation container's state-change callback.
147
148
  await OneUptimeReplay.setRoute("/checkout?payment_token=discarded");
@@ -166,6 +167,53 @@ fragments and are stored as `app://com.example.checkout/checkout`. The
166
167
  remaining path stays readable, so pass stable screen templates rather than
167
168
  account names, order numbers, or other sensitive path values.
168
169
 
170
+ ## Product analytics events and metrics
171
+
172
+ With **Send product analytics events** on for the RUM application (its
173
+ **Analytics Settings** page in OneUptime), the SDK also sends the
174
+ application's product analytics: the session's start, each screen
175
+ `setRoute()` names as a page view, every `track()` event, and the numbers
176
+ the app measures with `metric()`:
177
+
178
+ ```ts
179
+ OneUptimeReplay.track("checkout_opened", { cartSize: 3 });
180
+ OneUptimeReplay.metric("cart.value", 42.5, { currency: "EUR" });
181
+ ```
182
+
183
+ They feed the application's **Events**, **Funnels** and **User Retention**
184
+ pages, and a `metric()` point is a point of a metric of the application's,
185
+ for charts, dashboards and Metrics monitors. They follow the browser
186
+ recorder's contract (`Common/Types/Rum/ProductAnalyticsEvents.ts`, copied
187
+ in `src/ProductAnalyticsContract.ts` and held to it by `ContractParity`):
188
+
189
+ - **Every session, recorded or not.** The replay sample decides which
190
+ sessions are recorded, not which are counted: a session it leaves out
191
+ still sends its events (`start()` still resolves `false` for it, as
192
+ before), and those events are what keeps its session alive.
193
+ - **Consent.** When the policy requires consent, events wait for
194
+ `grantConsent()`, at most 500 of them, and are then filed under the
195
+ session the grant opens; `revokeConsent()` drops them.
196
+ - **Masked as the recording is.** The SDK always masks text, so property,
197
+ attribute and trait values arrive masked; event names, keys and metric
198
+ values are sent as written. A screen is its scrubbed route.
199
+ - **Small batches.** Every 5 seconds and as the app leaves the foreground,
200
+ at most 100 events and 100 metric points each, one session's and one
201
+ person's per batch. A failed batch is retried with backoff up to 5 minutes
202
+ (a `Retry-After` is honoured up to 300 seconds), at once when the app
203
+ returns to the foreground or a `connectivity` source says the device is
204
+ back online, and nothing is tried while it says the device is offline.
205
+ Events are held in memory: an app killed while offline loses the ones it
206
+ had not sent. A 204, 400 or 403 stops them until the next `start()`.
207
+ - **The context** is the one recorded sessions are filed under: `mobile`,
208
+ or `tablet` from a shorter side of 600 points; the system the native
209
+ module names; and the `appVersion` start option, or the binary's own.
210
+ - **Diagnostics.** `getDiagnostics().productAnalytics` reports `state`
211
+ (`off`, `on`, or why they stopped), `pending` and `dropped`; the codes
212
+ `analytics-started`, `analytics-stopped`, `metric-analytics-off`,
213
+ `metric-name-refused` and `metric-value-refused` say what happened.
214
+
215
+ `metric()` sends nothing while the events are off for the application.
216
+
169
217
  ## Manual and error capture
170
218
 
171
219
  ```ts
@@ -210,7 +258,8 @@ on a web page: the browser recorder detects those, and this SDK leaves them out.
210
258
 
211
259
  ```ts
212
260
  const diagnostics = OneUptimeReplay.getDiagnostics();
213
- // status, sessionId, sampled, triggered, consentState, pendingEvents, events
261
+ // status, sessionId, sampled, triggered, consentState, pendingEvents,
262
+ // productAnalytics, events
214
263
  ```
215
264
 
216
265
  Diagnostics contain recorder decisions and fixed reason codes, not view text.