@heycatch/sdk 0.8.4-dev.2561 → 0.8.5-dev.2546
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 +51 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +2 -2
- package/dist/react-native.cjs +1 -1
- package/dist/react-native.d.cts +18 -0
- package/dist/server.cjs +2 -2
- package/dist/server.d.cts +10 -2
- package/dist/server.d.ts +10 -2
- package/dist/server.js +2 -2
- package/dist/{shared-jAHOZrzL.d.cts → shared-nNQmChFP.d.cts} +9 -0
- package/dist/{shared-jAHOZrzL.d.ts → shared-nNQmChFP.d.ts} +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,6 +51,7 @@ analytics.init({
|
|
|
51
51
|
cookieExpirationDays: 365, // days before the persistence cookie expires
|
|
52
52
|
optOutCapturingByDefault: true, // start with capturing off - see below
|
|
53
53
|
respectDnt: true, // honor the browser's Do Not Track signal
|
|
54
|
+
collectIp: false, // don't store the visitor's IP address or their location - see below
|
|
54
55
|
});
|
|
55
56
|
```
|
|
56
57
|
|
|
@@ -73,6 +74,54 @@ it was. This is always on, has no option, and runs after your `beforeSend`,
|
|
|
73
74
|
so a hook cannot put a token back. It applies in the browser, in React
|
|
74
75
|
Native, and on the server alike.
|
|
75
76
|
|
|
77
|
+
### Visitor IP addresses
|
|
78
|
+
|
|
79
|
+
Set `collectIp: false` and no event stores the visitor's IP address, and no
|
|
80
|
+
country or city is derived from it. The address does not reach analytics
|
|
81
|
+
storage at all: the SDK blanks it on every event, after your `beforeSend`,
|
|
82
|
+
and HeyCatch's ingest drops it from the request too.
|
|
83
|
+
|
|
84
|
+
It is decided per visitor, so if your banner asks about IP or location you
|
|
85
|
+
can pass that answer straight through, and flip it when the visitor answers
|
|
86
|
+
later:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
// `=== true`: a visitor who has not answered yet is not collected either
|
|
90
|
+
analytics.init({
|
|
91
|
+
projectKey: 'hck_pk_...',
|
|
92
|
+
collectIp: storedIpAnswer() === true,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// in your consent banner's handler
|
|
96
|
+
analytics.setIpCollection(allowsIp); // false stops collecting from the next event
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Nothing is remembered between page loads or app launches: pass the
|
|
100
|
+
visitor's answer to `init()` every time. `setIpCollection()` before
|
|
101
|
+
`init()` logs a warning and does nothing. Unset, or `true`, collects the
|
|
102
|
+
IP as before. What `false` costs, and what it
|
|
103
|
+
does not promise:
|
|
104
|
+
|
|
105
|
+
- No country in your users table for new visitors, and no geo breakdowns
|
|
106
|
+
for those events. A returning visitor keeps the country already stored on
|
|
107
|
+
their profile from before.
|
|
108
|
+
- It applies from the SDK version that has it. A mobile app needs a new
|
|
109
|
+
release, and app versions already on users' phones keep sending IPs.
|
|
110
|
+
- It has to be set on every surface you ship - your site and your app each
|
|
111
|
+
have their own `init()`. One left out keeps sending IPs for that surface.
|
|
112
|
+
- What you can tell your users is "we don't store your IP address or a
|
|
113
|
+
location derived from it" - for what they do after you turn it off; a
|
|
114
|
+
country already on a returning visitor's profile stays, and location you
|
|
115
|
+
send yourself in event or person properties is stored as you sent it.
|
|
116
|
+
Not "your analytics is anonymous":
|
|
117
|
+
the device id, and your own user id after `setIdentity`, stay on events.
|
|
118
|
+
If your banner asks for consent to analytics as a whole, that is the
|
|
119
|
+
[consent gate](#consent-gate) below, not this switch.
|
|
120
|
+
|
|
121
|
+
It works in the browser and in React Native. The server entry accepts
|
|
122
|
+
`collectIp` and `setIpCollection()` and ignores both: a server event's
|
|
123
|
+
request comes from your server, not a visitor.
|
|
124
|
+
|
|
76
125
|
### Consent gate
|
|
77
126
|
|
|
78
127
|
Set `optOutCapturingByDefault: true` to capture nothing until your visitor
|
|
@@ -107,8 +156,8 @@ to consent for - each one already names its `userId` and only happens
|
|
|
107
156
|
because your code called it.
|
|
108
157
|
|
|
109
158
|
The remaining options above are browser behaviour. React Native honours
|
|
110
|
-
`optOutCapturingByDefault`; the rest describe a DOM and a
|
|
111
|
-
does not have. The server entry accepts the same `HeyCatchConfig` so one
|
|
159
|
+
`optOutCapturingByDefault` and `collectIp`; the rest describe a DOM and a
|
|
160
|
+
browser store it does not have. The server entry accepts the same `HeyCatchConfig` so one
|
|
112
161
|
object works under every import condition, and ignores them.
|
|
113
162
|
|
|
114
163
|
## Delivery options
|