AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

4.4K members online now
4.4K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
Guide Me

User Id implementation - Issues

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭



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.




1 Expert replyverified_user

Re: User Id implementation - Issues

[ Edited ]
Top Contributor
# 2
Top Contributor

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!forum/tag-manager


Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here