Our team is switching to GTM and using the Snowplow template. However we are seeing a critical issue when using the setUserId command in GTM, please see the screenshot below:
As you can see, right after the the account_sign_in event, the user_id was successfully set. However all the rest of the events’ user_id turns to null again.
This is very unstable when I was in debug mode. Not sure if it is some issues with GTM or would it be the issue of the snowplow template in GTM.
Please shed some light, thank you
Hi @kuangmichael07 ,
It’s likely something to do with the implementation. Generally, once set, the userId is persistent until one calls setUserId again.
If you set the user ID to an empty string or null, it’ll reset it back to null. So, if setUserId is being called on every page view, but the value is only present in the datalayer/available to the tracker for one of those page views, we’d likely see this behaviour.
However beyond that guess, it’s hard to give you much direction without more information:
Not sure if it is some issues with GTM or would it be the issue of the snowplow template in GTM.
Can you point us to the template you’re using?
Also, can you share details of how setUserId is being called/set?
Thank you for the quick response.
- Both the Snowplow Analytics and Snowplow Analytics Settings template are directly imported from the Community Template Gallary, we only modified the Permission tab.
- And for how we use the setUserId, please see the screenshot below:
- setUserID tag:
- The custom js that fetch userId from datalayer:
- The custom trigger for the tag:
In the debug mode, we verified that the trigger was fired only once:
Please let me know if you think of other information that could help debug.
Thank you so much for the help