Skip to content

Commit 6735158

Browse files
Merge pull request #7051 from segmentio/niall/cookie_npm
Add cookie implementation details for the NPM package
2 parents 9227e31 + 83d1cc6 commit 6735158

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,22 @@ analytics.load('writeKey', {
4343
}
4444
})
4545
```
46+
47+
To set cookie values using the [NPM package](https://github.com/segmentio/analytics-next/tree/master/packages/browser){:target="_blank"}, use the following code snippet:
48+
49+
```js
50+
analytics = AnalyticsBrowser.load({
51+
writeKey: 'writeKey'
52+
}, {
53+
cookie: {
54+
domain: 'sub.site.example',
55+
maxage: 7, // 7 days
56+
path: '/',
57+
sameSite: 'Lax',
58+
secure: true
59+
}
60+
})
61+
```
4662
> info ""
4763
> 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.
4864

0 commit comments

Comments
 (0)