Analytics
4.9K members online now
4.9K 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

How UserId Actually Works any help?

Explorer ✭ ✭ ✭
# 1
Explorer ✭ ✭ ✭

Hello all,

 

I have a question from many days.I want to know how actually userid feature in GA actually works.Now I know that it is basically assigning a unique id to a user from our end.It is fine.Now it is not many question.My question is about the underlying technology behind it.

 

Suppose a user first comes to my website from mobile,then again after some time the same user comes to my website now using desktop.Now my question is how does GA identifies it is the same user who first come from mobile then using desktop.

 

My assumption is GA stores the usual cookie in the user device(mobile) for the first time, now if the user then again comes to my site using same mobile then there is a scope that GA will identify that he is a returning user using the stored cookie info.

But in my case the same user now comes from another device desktop.So there is now another cookie stored in desktop for that user this time.So how does GA connect the missing link between the two devices.

 

Please explain

How UserId Actually Works any help?

A T
Participant ✭ ✭ ✭
# 2
A T
Participant ✭ ✭ ✭

As GA explains:

<<

User-ID enables the association of one or more sessions (and the activity within those sessions) with a unique and persistent ID that you send to Analytics.

To implement User-ID, you must be able to generate your own unique IDs, consistently assign IDs to users, and include these IDs wherever you send data to Analytics.

>>

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

 

So the IDs are assigned by us post login, so when same ID is sent from mobile and desktop GA knows it is the same user.

How UserId Actually Works any help?

Explorer ✭ ✭ ✭
# 3
Explorer ✭ ✭ ✭

Means we need some developer help here.Suppose if a user comes though desktop we have to assign a unique id in the way that the id will not change if the same user then again visit through mobile?

How UserId Actually Works any help?

A T
Participant ✭ ✭ ✭
# 4
A T
Participant ✭ ✭ ✭

user id feature is used to identify logged in users.

 

so most probably we send crm id or unique user identifier. No PII.

How UserId Actually Works any help?

Explorer ✭ ✭ ✭
# 5
Explorer ✭ ✭ ✭

Suppose I have a login option where user have to login .Now after successful login user comes to a page 'successful login page' now do i have to assign userid only to this page or have to send user id hits all the pages after user login ?

How UserId Actually Works any help?

Explorer ✭ ✭ ✭
# 6
Explorer ✭ ✭ ✭

Are you there?

How UserId Actually Works any help?

A T
Participant ✭ ✭ ✭
# 7
A T
Participant ✭ ✭ ✭

post successful login send it only once.

How UserId Actually Works any help?

Follower ✭ ✭ ✭
# 8
Follower ✭ ✭ ✭

Hi Soumik,

 

You set it once and it will be fixed at the user level for that specific user. All subsequent hits will be using their specific User ID.

Users must also authenticate on different devices to get the cross device tracking etc..


Thanks

A

How UserId Actually Works any help?

[ Edited ]
Explorer ✭ ✭ ✭
# 9
Explorer ✭ ✭ ✭

Thanks all for your reply.

Suppose I want to use this code below where there is an userid set:

 

here $userid is the server variable which is assigned to each user who log in successfully dynamically.I want to place it in the header portion of my website.So it is available always.


<?php
if (isset($userid)){
?>
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event' : 'userIdSet',
'userId' : '$userid'
});
</script>
<?php
}
?>

 

Now after once sent the subsequent pageviews,all hits shouuld be assigned as expected.I think.