-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat(useCookie): skip anonymous userToken if useCookie is false #236
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit fa4e239:
|
README.md
Outdated
@@ -65,6 +65,7 @@ aa('setUserToken', 'USER_ID'); | |||
| **`apiKey`** | `string` | None (required) | The search API key of your Algolia application | | |||
| `userHasOptedOut` | `boolean` | `false` | Whether to exclude users from analytics | | |||
| `region` | `'de' \| 'us'` | Automatic | The DNS server to target | | |||
| `useCookie` | `boolean` | `true` | Whether to use cookie in browser environment. The anonymous user token will not be set if `false`. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after this, I think we should release a version with useCookie as true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean false
as a breaking change? It's true by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry I meant false
in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah it should be false
in the next major version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good to go!
…js into feat/use-cookie
This PR adds an option
useCookie
toinit
method.Its default value is
true
, but it needs to befalse
in the next major version to avoid the situation where our customers set cookies in end-users' browsers without knowing it.hasUserOptedOut
vsuseCookie
If user denies to be tracked, for example, by clicking "deny" button on a cookie popup, then
userHasOptedOut
should be true, and search-insights won't send any event from the user. So this is per-user setting.On the other hand, if a website decides not to use anonymous user token in cookie at all, then they can set
useCookie: false
. It means search-insights will not generate/store any anonymous user token in the cookie. So aa will not have any user token initially.setUserToken
must be called explicitly. Once auserToken
is set, it will send events.