Skip to content

Commit 1e07740

Browse files
authored
Merge pull request #4697 from segmentio/vanand17-patch-10
Update cookie validity.md
2 parents cf8dc45 + 036fca4 commit 1e07740

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/connections/sources/catalog/libraries/website/javascript/persistence.md renamed to src/connections/sources/catalog/libraries/website/javascript/cookie-validity-update.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Client-side persistence in Analytics.js
3+
redirect_from: '/connections/sources/catalog/libraries/website/javascript/persistence/'
34
strat: ajs
45
---
56

@@ -18,14 +19,14 @@ If a user returns to your site after the cookie expires, Analytics.js looks for
1819
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.
1920

2021
> info ""
21-
> Analytics.js doesn't set third-party cookies and only sets first-party cookies.
22+
> Analytics.js doesn't set third-party cookies and only sets first-party cookies.
2223
2324
Here is the full list of available parameters with their default values:
2425

2526
| Parameter | Description | Default value |
2627
| --- | --- | --- |
2728
| `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 |
28-
| `maxage` | The maximum amount of time in seconds before the cookie expires. Browsers may clear cookies before this elapses. | 1 year |
29+
| `maxage` | The maximum amount of time in days before the cookie expires. Browsers may clear cookies before this elapses. | 1 year |
2930
| `path` | The path the cookie is valid for. | `"/"` |
3031
| `sameSite` | This prevents the browser from sending the cookie along with cross-site requests. | `Lax` |
3132
| `secure` | This determines whether cookies can only be transmitted over secure protocols such as https. | `false` |
@@ -35,13 +36,15 @@ Example:
3536
analytics.load('writeKey', {
3637
cookie: {
3738
domain: 'sub.site.example',
38-
maxage: 604800, // 7 days in seconds
39+
maxage: 7, // 7 days
3940
path: '/',
4041
sameSite: 'Lax',
4142
secure: true
4243
}
4344
})
4445
```
46+
> info ""
47+
> Chrome has a maximum limit of 400 days for cookies. If a value is set beyond that, then Chrome sets the upper limit to 400 days instead of rejecting it. Visit Chrome's [docs](https://developer.chrome.com/blog/cookie-max-age-expires/){:target="blank"} to learn more.
4548
4649
### User settings
4750

0 commit comments

Comments
 (0)