Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cookie implementation details for the NPM package #7051

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ analytics.load('writeKey', {
}
})
```

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:

```js
analytics = AnalyticsBrowser.load({
writeKey: 'writeKey'
}, {
cookie: {
domain: 'sub.site.example',
maxage: 7, // 7 days
path: '/',
sameSite: 'Lax',
secure: true
}
})
```
> info ""
> 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.

Expand Down
Loading