Some events are returning a 422 http response code. The error says: The userToken field is required. Can someone provide any insight as to why some of these are being returned with this code?
We are using Google Tag Manager.
Is this a logged in vs non logged in result? Or adblocker vs non-adblocker?
Your Q is too general. “Some events” + No way to know how you set up your GTM.
@siton22, Thank you for your response. Here are some we set up.
Do you want to see the User-defined variables as well?
Compare to this:
- Variable Name:
Algolia Insights User Token
- Data Layer Variable Name:
All events need to include a userToken that relates a user profile to an event.
The docs not so clear related to this issue by the way (search-insights@v1 VS search-insights@v2 - very hard to understand).
Anyway the first step is under GTM debugger to check the value of
algoliaUserToken (If it empty - it is make sense you get the error: " userToken field is required").
If the value is empty - start from “static” value:
userToken: '123456' (The error disappear? Y/N).
If the answer is Y: Ask the dev to generate and store anonymous user token for each user.
Look at this warning:
Since v2, search-insights doesn’t generate and store anonymous user token in the
_ALGOLIA cookie by default. If you wish to keep the behavior, you can pass
useCookie: true to
@siton22 It is completed: