Analytics
1.7K members online now
1.7K 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
star_border
Reply

UserID - User Identification

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Cookies and User Identification  |  Analytics for Web (analytics.js)  |  Google Developers

Is this actually working? (see code below)
I can see hits in the real time All Site Data View, but nothing in the UserID enabled view, not even after few days.
If we send the userid before sending the page it works, but if we try to send it after, nothing shows up in any reports in the UserID enabled view.
Any ideas? Is this a known bug?
Thank you
Nick


// Creates the tracker and sends a pageview as normal

// since the `userId` value is not yet known.
ga
('create', 'UA-XXXXX-Y', 'auto');
ga
('send', 'pageview');

// At a later time, once the `userId` value is known,
// sets the value on the tracker.
ga
('set', 'userId', USER_ID);


1 Expert replyverified_user

Re: UserID - User Identification

Top Contributor
# 2
Top Contributor
Hi Nick,

You need to enable session unification, please check the document below about it.

https://support.google.com/analytics/answer/4574780

Hope this helps.

Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: UserID - User Identification

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Arnold, thank you for your answer but session unification is enabled, that is actually the default setting.
To summarize:
.This works:
....
ga('set', 'userId', USER_ID);
ga('send', 'pageview');

This doesn't work:
...
ga('send', 'pageview');
ga('set', 'userId', USER_ID);

Session unification is enabled.

I am starting to believe that this is a bug on Google's side, other people were complaining about this issue as well.
Do you have any other ideas that could help?
Thank you
Nick