You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/connections/sources/catalog/libraries/website/javascript/persistence.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,23 +5,23 @@ strat: ajs
5
5
6
6
This page explains what data Analytics.js stores on the client and how to override and change what and how this data is stored.
7
7
8
-
## Segment ID Persistence
8
+
## Segment ID persistence
9
9
10
10
<!-- Note: 1st 2 paragraphs copied from identity.md -->
11
11
12
-
To ensure high fidelity, first-party customer data, Segment writes the user's IDs to the user's local storage, and uses that as the Segment ID on the cookie whenever possible. Local storage is for storing this type of first-party customer information.
12
+
To ensure high fidelity, first-party customer data, Segment writes the user's IDs to the user's local storage and uses that as the Segment ID on the cookie whenever possible. Local storage is for storing this type of first-party customer information.
13
13
14
14
If a user returns to your site after the cookie expires, Analytics.js looks for an old ID in the user's `localStorage`, and if one is found, it sets as the user's ID again in the new cookie. If a user clears their cookies _and_`localStorage`, all of the IDs are removed, and the user gets a completely new [`anonymousID`](/docs/connections/sources/catalog/libraries/website/javascript/identity/#anonymous-ids) when they next visit the page.
15
15
16
-
### Cookie Settings
16
+
### Cookie settings
17
17
18
18
Analytics.js sets some default properties when creating cookies for user or group identities. You can override the default cookie properties in code when loading Analytics.js by passing in a `cookie` object to the load method.
19
19
20
20
Here is the full list of available parameters with their default values:
21
21
22
22
| Parameter | Description | Default value |
23
23
| --- | --- | --- |
24
-
|`domain`| The domain to set the cookie to. This must match the domain of the JavaScript origin. Cookies set on top-level domain are available to sub-domains. | Top-level domain |
24
+
|`domain`| The domain to set the cookie to. This must match the domain of the JavaScript origin. If an Analytics.js cookie already exists at the top-level domain, Segment carries the same cookie value to any subdomains, despite `domain` configuration. | Top-level domain |
25
25
|`maxage`| The maximum amount of time in seconds before the cookie expires. Browsers may clear cookies before this elapses. | 1 year |
26
26
|`path`| The path the cookie is valid for. |`"/"`|
27
27
|`sameSite`| This prevents the browser from sending the cookie along with cross-site requests. |`Lax`|
@@ -40,7 +40,7 @@ analytics.load('writeKey', {
40
40
})
41
41
```
42
42
43
-
### User Settings
43
+
### User settings
44
44
45
45
Analytics.js automatically persists the user's ID and traits locally. You can override how and where the user ID and traits are stored when loading Analytics.js by passing in a `user` object to the load method.
46
46
@@ -68,7 +68,7 @@ analytics.load('writeKey', {
68
68
})
69
69
```
70
70
71
-
### Group Settings
71
+
### Group settings
72
72
73
73
Analytics.js automatically persists the user's group ID and group properties locally. You can override how and where the group ID and properties are stored when loading Analytics.js by passing in a `group` object to the load method.
74
74
@@ -95,11 +95,11 @@ analytics.load('writeKey', {
95
95
})
96
96
```
97
97
98
-
## Persistent Retries
98
+
## Persistent retries
99
99
100
100
When enabled, Analytics.js automatically retries network and server errors. When the client is offline or your application can't connect to Segment's API, Analytics.js stores events in `localStorage` and falls back to in-memory storage when `localStorage` is unavailable.
101
101
102
-
## Disable All Client-Side Persistence
102
+
## Disable all client-side persistence
103
103
104
104
<!-- TODO: Mention GDPR and/or regulations as a reason to do this? -->
105
105
Analytics.js supports disabling persisting any data locally. This will force analytics.js to store data in-memory only and disables automatic identity tracking across pages.
When `disableClientPersistence` is set to `true`, Analytics.js won't be able to automatically keep track of a user's identity when navigating to different pages. This can cause increased MTU usage if the anonymous usage can't be associated with a `userId`.
116
116
117
-
You can still manually track identity by calling `analytics.identify()` with the known identity on each page load, or you can pass in identity information to each page using the [querystring API](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/querystring/).
117
+
You can still manually track identity by calling `analytics.identify()` with the known identity on each page load, or you can pass in identity information to each page using the [querystring API](/docs/connections/sources/catalog/libraries/website/javascript/querystring/).
118
118
119
-
### Event Retries
119
+
### Event retries
120
120
121
121
Analytics.js tries to detect when a page is about to be closed and saves pending events to `localStorage`. When the user navigates to another page within the same domain, Analytics.js attempts to send any events it finds in localStorage.
0 commit comments