User Id implementation - Issues
I have implemented user id while upgrading from Classic Analytics to Universal Analytics using GTM.
We have implemented user id as a custom variable and set its scope as 'user' then changed to 'session' and now 'hit'.
The problem i am facing is if i am logged in from one user and place an order then without closing log out and then place order with another user, its mapping orders to the last user (id) only. I have checked the source and tested in preview toll of GTM as well, and everything is working fine there. But in GA reports its mapping all orders to the last user id.
Re: User Id implementation - Issues[ Edited ]
March 2016 - last edited March 2016
Hi Akash :-)
I have very limited experience with the User ID feature.
I'm not quite understanding what you mean by the following:
if i am logged in from one user and place an order then without closing log out and then place order with another user
Just to clarify - you are logging out as the first user and then logging in as the 2nd user?
If so.. are you unsetting the user id?
Unsetting the User ID
The Google Analytics User ID policy requires that you stop tracking user ID once a user signs out of your website. So, you'll need to unset the user ID if the user signs out.
If the user ID is being persisted in a cookie, and Google Tag Manager reads the user ID value from the cookie, you simply need to delete the cookie whenever a user signs out. This is a typical practice anyway, since you usually want to clear the signed-in state from cookies once a user signs out.
Once the cookie has been deleted, Google Tag Manager won't find it and will stop sending the user ID to Google Analytics. Once the cookie is present again (i.e. the user signs back in), Google Tag Manager will resume sending the user ID to Google Analytics.
If the session isn't ending and the user id isn't unset, then that order would be seen as the last user id
eta - also for help with GTM related questions, you may want to also ask on the GTM Help Forum
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here