The user token sent with search queries must match the userToken parameter sent with events. This means you should be sending the anonymous/session user token with search queries.
Our current recommendation is:
-
Send the same anonymous/session
userToken
in both the search and eventsuserToken
parameters -
If a user logs in (authenticated users), send the
authenticatedUserToken
in theauthenticatedUserToken
events parameter -
Do not replace
userToken
with the authenticated user token in search queries or events -
Following this means:
-
both the anonymous and authenticated user tokens will be sent with each event to ensure that data collected when users weren’t authenticated isn’t lost
-
user profiles for Personalisation continue to be updated, as profiles are currently built using
userToken
-
More info on these parameters can be found here:
-
User Token: https://www.algolia.com/doc/api-reference/api-parameters/userToken/#how-to-use
-
Authenticated User Token: https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/#authenticated-user-token
Useful Guides: