Reputation: 35
I integrated the Google Analytics User-ID feature on our website today (in combination with Google Tag Manager). It's working great for logged in users.
I use the UID of our system for logged in users.
However, I am not sure which value has to be used for users that are not logged in.
Currently, it's just blank if the userId
value can not be set because the user is not logged in yet.
Is it okay if its just blank? Or do I have to set the value to something specific?
I thought about:
userId
in the GTMclientId
that is stored in the _ga
cookieBut I just don't know which what the correct thing to do is here. I can't find a clear answer to this online, and the Google Guides and Documentations don't expressively say anything about it either that I've seen.
I would really appreciate any help with this. And thank you in advance for your suggestions and answers!
Cheers!
Upvotes: 1
Views: 2033
Reputation: 1515
When a user is logged out, you should just totally skip pushing the userId
onto the dataLayer. In this case, the GTM userId
variable will resolve to undefined
(because it will not find such a key on the dataLayer) and Google Analytics will ignore it altogether and the &uid
query parameter will not be sent to GA.
Upvotes: 3