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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
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,21 @@ analytics.load('writeKey', {
}
})
```

To set these values via the [NPM package](https://github.com/segmentio/analytics-next/tree/master/packages/browser), you can set these cookie values like so:
niallzato marked this conversation as resolved.
Show resolved Hide resolved
```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