@anyreplay/browser 0.1.4 → 0.2.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 +16 -1
- package/dist/index.cjs +1151 -129
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +599 -97
- package/dist/index.d.ts +599 -97
- package/dist/index.js +1135 -129
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -25,12 +25,26 @@ const recorder = createRecorder({
|
|
|
25
25
|
// maskAllInputs: true, // off by default: field values are recorded
|
|
26
26
|
// maskAllTyping: true, // the stricter switch: fields and rich-text editors
|
|
27
27
|
// maxSessionsPerMonth: 5000, // optional cap for this project
|
|
28
|
+
// appId: 'com.example.shop', // only inside an app shell (Capacitor, Electron); see below
|
|
28
29
|
});
|
|
29
30
|
|
|
30
31
|
recorder.track('checkout_clicked', { plan: 'growth' });
|
|
31
32
|
recorder.identify({ userId: 'u_42', email: 'ada@example.com' });
|
|
32
33
|
```
|
|
33
34
|
|
|
35
|
+
### Inside an app
|
|
36
|
+
|
|
37
|
+
A page running inside a Capacitor, Cordova or Electron app has no real web
|
|
38
|
+
origin — its web view reports `capacitor://localhost`, `https://localhost` or
|
|
39
|
+
`file://` — so a project that lists allowed domains refuses it. Add the app's
|
|
40
|
+
bundle id or package name under **Allowed apps** in the project's settings,
|
|
41
|
+
and pass the same value as `appId`. Leave `appId` out on a website: from a
|
|
42
|
+
real web origin it is ignored, so it cannot open a web project's domain list.
|
|
43
|
+
It is a filter, not a secret.
|
|
44
|
+
|
|
45
|
+
Every session also reports `platform: 'web'` and this package's name and
|
|
46
|
+
version, so the dashboard can say what recorded it.
|
|
47
|
+
|
|
34
48
|
Prefer a script tag? Create a project in the dashboard and copy the snippet
|
|
35
49
|
from its setup page; it loads the same code from `cdn.anyreplay.com`.
|
|
36
50
|
|
|
@@ -40,8 +54,9 @@ from its setup page; it loads the same code from `cdn.anyreplay.com`.
|
|
|
40
54
|
|---|---|
|
|
41
55
|
| `createRecorder(options)` | Starts recording (or waits for consent) and returns a handle |
|
|
42
56
|
| `handle.track(name, properties?)` | Tags this moment; `name` is 1–64 chars of `[A-Za-z0-9_.:-]`, properties a JSON object ≤ 4 KB |
|
|
57
|
+
| `handle.trackError(error)` | Records an error you caught yourself, redacted, and marks the session as having one |
|
|
43
58
|
| `handle.identify({ userId?, email? })` | Attaches your user id to the session |
|
|
44
|
-
| `handle.consent(true)` | Starts recording when `requireConsent: true`; `consent(false)` keeps it off |
|
|
59
|
+
| `handle.consent(true)` | Starts recording when `requireConsent: true`; `consent(false)` keeps it off, and a later `consent(true)` still starts it |
|
|
45
60
|
| `handle.status()` | `idle`, `awaiting-consent`, `recording`, `sampled-out` or `stopped` |
|
|
46
61
|
| `handle.flush()` | Sends what is buffered now; resolves when delivered |
|
|
47
62
|
| `handle.stop()` | Stops for this page |
|