@heycatch/sdk 0.7.0-dev.714 → 0.7.0-dev.974

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
@@ -5,6 +5,63 @@ The official [HeyCatch](https://heycatch.ai) package for your app.
5
5
  _(AI Agents: the setup guide is https://heycatch.ai/agents.md - you also need
6
6
  the project key from the user's HeyCatch dashboard Install page.)_
7
7
 
8
+ ## Privacy & consent options
9
+
10
+ `init()` accepts optional privacy/consent options alongside `projectKey`. Every
11
+ one is unset by default, and each takes effect only when you set it - so
12
+ `init({ projectKey })` on its own captures exactly as it always has:
13
+
14
+ ```ts
15
+ analytics.init({
16
+ projectKey: 'hck_pk_...',
17
+ autocapture: false, // turn off automatic click/form-submit capture (pageviews and rage-clicks are captured separately, unaffected)
18
+ maskAllText: true, // strip captured elements' text content
19
+ maskAllElementAttributes: true, // strip captured elements' attributes
20
+ propertyDenylist: ['some_property'], // drop specific properties from every event (HeyCatch's own attribution keys can't be denylisted)
21
+ beforeSend: event => event, // runs on every event right before it's queued; return null to drop it
22
+ persistence: 'localStorage', // where the distinct id + super properties are stored
23
+ disablePersistence: false, // disable persistence entirely
24
+ cookieExpirationDays: 365, // days before the persistence cookie expires
25
+ optOutCapturingByDefault: true, // start with capturing off - see below
26
+ respectDnt: true, // honor the browser's Do Not Track signal
27
+ });
28
+ ```
29
+
30
+ In the browser, setting `autocapture: false`, `maskAllText: true`, or
31
+ `maskAllElementAttributes: true` logs a one-line console notice naming what
32
+ it costs you in the dashboard. (The other entries ignore these options, so
33
+ they have nothing to warn about - see the platform notes below.)
34
+
35
+ ### Consent gate
36
+
37
+ Set `optOutCapturingByDefault: true` to capture nothing until your visitor
38
+ agrees (behind a cookie banner, for example), then:
39
+
40
+ ```ts
41
+ analytics.optInCapturing(); // consent granted - start capturing
42
+ analytics.optOutCapturing(); // consent withdrawn - stop again
43
+ ```
44
+
45
+ While the gate is closed nothing is written to browser storage either, so no
46
+ identifier lands before consent - not just "no events sent".
47
+
48
+ Call `init()` before either one. Neither is remembered if it runs first -
49
+ there is no transport yet to carry the decision - and both warn on the
50
+ console when that happens rather than failing quietly. `init()`'s own config
51
+ always wins, so a call made too early can never silently flip
52
+ `optOutCapturingByDefault` back on.
53
+
54
+ `optInCapturing` / `optOutCapturing` exist on every entry, so shared code
55
+ compiles everywhere. They are a real gate in the browser and in React
56
+ Native. On the server they are no-ops: a server event has no ambient visitor
57
+ to consent for - each one already names its `userId` and only happens
58
+ because your code called it.
59
+
60
+ The remaining options above are browser behaviour. React Native honours
61
+ `optOutCapturingByDefault`; the rest describe a DOM and a browser store it
62
+ does not have. The server entry accepts the same `HeyCatchConfig` so one
63
+ object works under every import condition, and ignores them.
64
+
8
65
  ## License
9
66
 
10
67
  MIT