0

I have couple of Custom Dimensions in my Google Analytics account set up - cd1 and cd6 (dimension1, dimension6).

Through code I pass the values for these dimensions, the diemnsion1 is userId and dimension6 is userRole.

When passed through code, the values are correct and event in GTM debugger, and even in collect API - the values are correct while pushing to GA (cd1 and cd6 values).

But in GA when I see in custom reports or in Behavior --> Top Events, the values are incorrect. UserId will be showing the incorrect session's userId value,.

For an event called event_1 :

I login as User_A do this event - event_1, which is logged in GA with Event Action text as "A". I login as User_B do this event - event_1, which is logged in GA with Event Action text as "B".

Now when I click to see this event in GA - Behavior --> Events --> Overview --> event_1

The record which was done for Event Action "B" and which was originally done by User_A, is showing User_B as Custom dimension "UserId" value.

I know this is due to cookie and session problem, but not sure how to fix it. I tried to expire the _ga and _gid cookie on logOut button click but it does not help much. Below is the _ga and _gid cookie expire code use :

document.cookie = '_ga=; path=/; domain='+ domain + '; expires=' + new Date(0).toUTCString();
document.cookie = '_gid=; path=/; domain='+ domain + '; expires=' + new Date(0).toUTCString();

Collect

1
  • Which version of Google Analytics are you using? Are you using the new GA4 or the older Universal Analytics? Jun 28 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.