Clear uid parameter after logout with Google Analytics

Bronze Contributor
Bronze Contributor

Hi

I´m configuring an app for mobile with Teamlium and Google Analytics. The app has two parts, one with login user and the other without.

When I logout the value of the uid parameter doesnt't reset to null and It's still sending to Google Analytics. I have other two custom dimensions with user datas that I´m able to clean setting them to null, but not with the uid.

Is there a way to do it? Anyone else with the same problem?

Thanks!

2 REPLIES 2

Clear uid parameter after logout with Google Analytics

Employee Emeritus

Hello @APM. Perhaps @christina_sund or @jason_koo can assist you? 

Remember to give me a kudo if you like my post! Accepting my post as a solution is even better! Also remember that search is your friend.

Clear uid parameter after logout with Google Analytics

Gold Contributor
Gold Contributor

@APM, I'm not sure how you're persisting the uid /user ID while logged in - localstorage, cookie, native app variable, audienceStream enhanced item in IQ?

But regardless of the method, if you create a new, separate, data layer object that acts as the middle man, and then use that for the mapping to "uid" in the GA tag, that should take care of your issues.  Just add the variable, then create a javascritp extension that feeds the variable from whatever your source is - but add in the conditions that you care about (i.e, only feed it when logged in).  If you want to be extra safe, you could set the variable to null or delete it before filling it each time to make sure it doesn't persist in some angular/app frameworks.

 

That said - are you sure you want to do that?  removing the UID from google will significnatly limit the analyitcs you can use it for.  Especially for sessionsthat are closely linked to a individual person as app sessions are -even when someone isn't logged in, I'd expect a lot of use for being able to look at their entire session's activity in GA from unauthenticated to authenticated and back.

 

Also, if you aren't also reseting/clearing the cid/_ga cookie value, clearing the UID may not break the session analytics as much as you were hoping since non-UID properties will still catch the entire session..

Public