Google Analytics User ID Explained

What is User ID in Google Analytics?

User ID is a unique set of alphanumeric characters (like GdffTeeD453589) assigned to a user so that he/she can be identified across devices/ browsers and over the course of multiple sessions.

Google Analytics cannot generate unique IDs for you that can be used as User IDs. You also can not use client IDs as user IDs. It doesn’t work that way.

In order to implement the user ID feature, you need to generate your own unique IDs and assign IDs to new and returning users through your user authentication system. 

This user authentication system is usually your website login, the system through which users can log in and log out.

The unique ID that you use to identify a logged-in user (also known as login ID) on your website can be sent as user ID to your GA account. However, the login ID should not contain personally identifiable information (PII) like name, email address, etc.

If your login ID contains PII then you may need to either remove that information from the Login IDs or completely rewrite the Login IDs before you send the Login IDs as User IDs to GA.

This is because the user ID usage policy requires that the user ID should not be a PII of a user. If you do not follow this usage policy then Google may terminate your GA account.

In order to implement user ID, you would need to write a code which can pull login IDs or other unique IDs from your authentication system and then place them in your Google Analytics tracking code.

That way the User IDs can be sent to the GA server along with the hit data. Consequently, any website which assigns login IDs to its users is a good candidate for implementing the user ID feature.

You can implement user ID features in many ways other than through a login system

For example, Walt Disney World tracks offline customers through a special wrist band known as the ‘Magic band’.

This colourful, harmless, innocent-looking band which is used to enter the parks, check in to Disney hotels, buy food and merchandise is actually a sort of tracking device through which the company collects browsing and buying behaviour of their offline customers.

Then through measurement protocol and user ID feature, this offline customer data is connected with the online data to get a holistic view of the customers’ journey.

Similarly, if someone uses some type of loyalty card for making a purchase in a supermarket, then that loyalty card can be scanned to assign a unique ID to the user which can later be sent to GA via measurement protocol and user ID.

Other users’ authentication systems widely used are:

  1. Biometric identification (like retinal scan, fingerprint scan, iris recognition, voice recognition, signatures, etc)
  2. Punching cards to record attendance (like attendance of employees)
  3. Wrist bands (like the one used by Disney)
  4. Retail loyalty cards (used by many supermarket chains)
  5. Online and offline Coupons

User IDs can be set for all of these authentication systems as well with the help of measurement protocol but the implementation is not going to be easy.

Once the user ID feature is implemented, GA combines and reports all the hits with the same user ID, regardless of the device, the hits come from. This makes cross-device measurement possible in GA.

You can send user ID to Google Analytics by creating a new custom dimension (with user scope):

ga(‘set’, ‘dimension1’,userId);

Note: You can implement the user ID feature for both websites and mobile applications.

Difference between User ID and Client ID

Through ‘user-id’, you can create and assign your own unique IDs to track unique users instead of using the ‘client IDs’ (generated by the Google Analytics tracking coding).

A client ID represents a unique device/browser. Whereas a user ID represents a unique user that may interact with your website using multiple devices/browsers.

It is important that you understand the difference between ‘client ID’ and ‘user ID’ and do not get confused. They are not the same thing.

To learn more about the difference between ‘Client ID’ and ‘User ID’, read this article: Understanding the difference between Client ID and User ID

Benefits of using the User ID

#1 The usage of user-id feature makes cross-device measurement possible in GA. This is the biggest benefit of using the user ID.

#2 Through user ID feature, GA can more accurately identify the number of unique users and their engagement activities (click on links, page navigation, screen navigation, etc) across multiple devices and/or sessions. As unlike client ID, the user ID can exist on multiple devices.

If a user is accessing your website from different devices/browsers then without user ID implementation, a unique user can be counted multiple times by GA.

For example,

If a user login to your website via smartphone and then later made a purchase via a company laptop, then in GA without user ID implementation, the number of unique users could be counted as two. But after user ID implementation, the number of unique users would be counted as one.

#3 You can attribute user engagement spread across multiple devices and sessions to a single user in your GA reports. Thus user ID helps in fixing attribution modelling issues.

#4 Through the user ID feature, you can get a holistic view of the users’ purchase journey.

#5 User ID is a great feature to segment and analyze the logged-in users, as these users generally engage with your website very differently than those who are not logged in. Logged in users behave differently than non-logged in users and you should create separate marketing campaigns to retarget them, to cross-sell or upsell them.

Get the E-book (52 Pages)

Get the E-Book (37 Pages)

 

User ID hits and sessions

In order to understand how user ID works, you need to get familiar with the user ID related terminologies which are frequently used:

1. User ID hits – these are those GA hits (pageviews, screenviews, events, transactions, etc) for which a user ID has been set.

2. Non-User ID hits – these are those GA hits for which a user ID has not been set.

Note(1): User ID hits are processed separately from non-user ID hits.

Note(2): If you are not using the user ID feature then the non-user ID hits are simply known as hits.

3. User ID session – It is the Google Analytics session in which a user ID is assigned to a user. User ID session is a collection of user ID hits but may also include non-user ID hits provided the session unification setting (more about it later) has been turned ON.

4. Non-user ID session – it is a collection of non-user ID hits. If you are not using the user ID feature then the non-user ID sessions are simply known as GA sessions.

Note: A standard session (non-user ID session) turns into a user ID session the moment a user ID is assigned to a user. This can happen when a user login in the middle of a standard GA session.

User ID Property

User ID property is that Google Analytics property in which user ID setting has been turned on:

User ID View

User ID view is the GA view which collects only the data related to user ID sessions:

You know you are looking at the user id view when you see the setting ‘User-ID Reports‘ enabled under ‘View Settings’.

You should consider adding the words ‘User ID’ somewhere in your view name for easy reference.

In the case of user ID views, GA calculates unique users by counting the number of unique users IDs assigned to the website visitors instead of counting the number of unique clients IDs assigned to the website visitors.

Non-user ID View

Non-user ID view is the GA view that collects data related to standard GA sessions.

It does not recognise user ID hits. In the case of non-user ID views (regular views), GA calculates unique users by counting the number of unique client IDs assigned to the website visitors.

You know you are looking at the non-user id view when you see the setting ‘User-ID Reports‘ disabled under ‘View Settings’:

If you are not using the user ID feature then the non-user ID views are simply known as views.

The number of unique users reported by non-user ID views is usually more than the number of unique users reported by user ID views. This is because user ID views only report on the users which triggered the user ID sessions.

Revenue in a user ID view is based on users and not sessions.

When does a regular GA session turn into a User ID Session?

If you are using login IDs as user IDs then as soon as a user logs in, a unique ID (login ID) is assigned to the user which is then sent as a user ID to GA. So once the user login, a regular GA session turns into a user ID session and the user ID is set for all subsequent hits.

By default, In Google Analytics, collected hits can be associated with a user ID only in a user ID session and that too before and during the user’s login but not after the user has logout.

So if the user doesn’t log in then the user ID is not assigned to him and no hits are associated with the user ID. Similarly, when the user logs out, the user ID is no longer assigned to him and the new collected hits are not associated with the user ID.

Get the E-Book (37 Pages)

Limitations of User ID

Through user ID feature you can not track users and their activity from the very first time they visited your website and before they decided to sign up and log in. Thus the user ID feature works well only for logged in users.

Now not all the users who visit your website login. So you may not be able to track a large portion of the users’ conversion journey. In order to overcome this limitation, you can keep your users logged in unless they explicitly logged out.

For example, Facebook keeps its users logged in all the time unless they explicitly logged out. In this way, Facebook is able to collect most of the cross-device behaviour data about its users.

Overcoming the limitations of User ID through session stitching

You can associate client IDs with user IDs to track users’ activities before they decided to sign-up and login through a method known as Session unification (or session stitching).

Thus to an extent, you can overcome the limitations of the user ID.

If a person visits your website without logging then a unique client ID is assigned to him. Now if the same person later logged in, then a unique User ID is assigned to him.

By associating the client ID with the user ID, you can determine what the logged-in person did on your website before he signed up and/or logged in. In this way, you can get a better picture of the user’s purchase journey.

However,

‘Session Unification’ won’t solve all of your attribution issues.

Associating client ID with user ID works well only when a person is visiting and logging in to your website via the same device and browser and he is the only person using that device and browser.

If multiple users are using the same device and browser (quite common in case of cyber café or office computers) then there is no guarantee that the person who browsed your website without logging in, is the same person who later visited your website after login.

Similarly, a person can visit your website via multiple devices and browsers before logging in. In that case, he would be assigned multiple client IDs but only one user ID. Session unification associates only one client ID with the user ID.

How to turn off session unification

Session unification is a user ID setting that can be turned ON and OFF.

Session unification is turned ON by default and it should be kept turned on unless your company’s privacy policy issue prohibits you from collecting such data.

Since the session unification setting is turned ON by default, all of the hits collected before the login and during the login, in a user ID session are automatically associated with the user ID.

If the session unification setting is turned off then only the hits collected during the login, in a user ID session can be associated with user ID. The hits collected before the login in the user ID session can not be associated with the user ID then.

To turn off the session unification follow the steps below:

Step-1: Navigate to the ‘Admin’ section of your User ID view.

Step-2: Click on the ‘User-ID’ link under ‘Tracking Info’ drop-down menu:

Step-3: Click on the ‘Edit’ link next to the step: ‘Set up the User-ID’:

Step-4: Scroll down a bit and then set the ‘Session Unification’ toggle switch to OFF:

Note(1): Turning OFF the session unification setting is not recommended.

Note(2): Session unification is only available for User ID enabled properties.

Setting up the User ID

The user ID feature is available only in universal analytics and is set at the property level. The implementation of user ID depends upon your environment/platform.

Setting up the user-id includes:

  1. Creating a new User ID view
  2. Generating unique IDs and then assigning them to website users.
  3. Sending IDs and all related engagement data to GA

How to create a new User ID view in Google Analytics

Follow the steps below to create a new User ID view in Google Analytics:

Step-1: Navigate to the Admin section of your GA Property and then click on the ‘user ID’ link under ‘tracking info’ drop-down menu:

Step-2: Read and agree to the user ID policy by toggling the blue switch to ‘ON’ and then click on the ‘Next Step’ button.

Step-3: Keep the ‘Session Unification’ setting intact (i.e. switched ON) and click on the ‘Next Step’ button:

Step-4: Click on the ‘Create’ button to create a new user ID view:

Note: The user ID data will appear only in the user ID view.

Step-5: Select your app (Website or Mobile App) for the User ID view:

Step-6: Name your new reporting view and select your ‘reporting time zone’:

Tip: Include the word ‘user ID’ somewhere in the reporting view name. This way, you can easily differentiate this view from regular views.

Step-7: Click on the ‘Create View’ button.

The process of creating the new User ID view is now complete.

Important points about the User ID view

#1 Make sure that, whenever you create a new user ID view, you include the words ‘User ID’ somewhere in your view name. In this way you can easily identify this reporting view later.

#2 You can create multiple user ID views on a user ID enabled property. The process is similar to creating multiple non-user ID views. Just turn the ‘user ID view’ toggle to ‘ON’.

#3 A user ID view collects and reports on only user ID sessions related data. So in order to get a complete picture of customer journeys, you need to use this view along with the non-user ID views.

#4 You will see data in your user ID view reports only after you have successfully implemented the user ID feature. Otherwise, your user ID view reports will remain empty. You won’t see any data in them, not even in the real-time reports.

#5 Cross-device reports are available in the user ID views.

#6 Any existing non-user ID view cannot be converted to a user ID view and vice versa. Therefore to collect user ID data, you have to create a new user ID view.

#7 User ID view collects data only after the user ID feature has been implemented. It can’t collect data retroactively.

#8 Once you have enabled the User ID feature for a view, you cannot disable it.

How to generate, assign (to website users) and send User IDs to Google Analytics

Add the following line of code to your Google Analytics tracking code, on each web page of your website before any hit data is sent:

ga(‘set’, ‘userID’, {{USER_ID}});

So your Google Analytics tracking code may look something like the one below:

<script>

(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)

})(window,document,’script’,’//www.google-analytics.com/analytics.js’,’ga’);

ga(‘create’, ‘UA-1234567-34’, ‘auto’);

ga(‘set’, ‘userID’, {{USER_ID}}); 

ga(‘send’, ‘pageview’);

</script>

Note: Do not copy-paste this code on your website. It won’t work. You would need to first modify this tracking code.

Here,

{{USER_ID}} is a server variable (of type string) which pulls the unique ID generated by your authentication system.

You or your developer needs to write a code through which login IDs can be pulled from your authentication system and sent as user IDs to GA. So,

your final google analytics tracking code after user ID implementation is also going to include some server-side script.

For example, if you use PHP as the backend script then your final Google Analytics tracking code may look like the one below:

GA tracking code for user ID

Ask your developer to write a code through which login IDs can be pulled from your authentication system and sent as user IDs to Google Analytics.

There are two points, you need to keep in mind before setting up the user ID:

#1 The user ID must be set after the tracking object has been created

#2 The user ID must be set before you send any hit data to Google Analytics

1. The user ID must be set after the tracking object has been created

The user ID must be set after the tracking object has been created. otherwise, the user ID will not be associated with your web property and won’t work.

So following user ID set up will not work:

ga(‘set’, ‘userId’, {{USER_ID}}); // user ID is set before the tracking object

ga(‘create’, ‘UA-1234567-34’, ‘auto’); // create a tracking object

ga(‘send’, ‘pageview’);

The correct user ID set up would be:

ga(‘create’, ‘UA-1234567-34’, ‘auto’); // create a tracking object

ga(‘set’, ‘userId’, {{USER_ID}}); // user ID is set after the tracking object

ga(‘send’, ‘pageview’);

Note: The user ID must be set on all the pages of your website otherwise you may not get accurate user data.

2. The user ID must be set before you send any hit data to Google Analytics

The user ID must be set before you send any hit data to GA. In this way, the user ID is set for all subsequent hits that occur on a page.

So following user ID set up is not recommended:

ga(‘create’, ‘UA-123456-34’, ‘auto’);

ga(‘send’, ‘pageview’);

ga(‘set’, ‘userId’, {{USER_ID}}); // here user ID is set after the pageview hit

The correct set up would look like the one below:

ga(‘create’, ‘UA-1234567-34’, ‘auto’);

ga(‘set’, ‘userId’, {{USER_ID}}); // here user ID is set before the pageview hit

ga(‘send’, ‘pageview’);

Similarly, the following user ID set up is not recommended:

ga(‘create’, ‘UA-1234567-34’, ‘auto’);

setTimeout(“ga(‘send’,’event’,’Profitable Engagement’,’time on page more than 3 minutes’)”,180000);

ga(‘set’, ‘userId’, {{USER_ID}}); // here user ID is set after the event hit

User ID coverage report

Through the user ID coverage report, you can determine the percentage of sessions that include activity from logged in users (provided your authentication system is login). Strangely you can’t access the ‘user ID coverage’ report through the ‘user ID’ view.

This report is available in any non-user id view which belongs to a GA property for which the user id is enabled. You can find this report under Audience > Behavior > User-ID Coverage:

This report shows the ‘user ID’ status which can be:

Unassigned – the number/percentage of sessions in which users weren’t assigned a user ID.

Assigned – the number/percentage of sessions in which users were assigned user id.

Note: Use the user ID coverage report in conjunction with user ID view reports.

Cross-device reports in Google Analytics

Once you have set up User ID in your Google Analytics property, you can then access and use the cross-device reports via the User ID view.

Through cross-device reports, you can get a better understanding of how users engage and convert on your website across different devices and over the course of multiple sessions.

To learn more about User ID cross-device reports, read this article: Google Analytics User ID Reports – Device Overlap, Device Paths, Acquisition Device

Related Articles

Frequently asked questions about User ID in Google Analytics

What is User ID in Google Analytics?

User ID is a unique set of alphanumeric characters (like 987eeetgd) assigned to a user so that he can be identified across devices/ browsers and over the course of multiple sessions.

How do I find my Google Analytics User ID?

You can find your Google Analytics user ids by navigating to 'User Explorer' report under the 'Audience' menu in your user id view.

How do I enable Google Analytics User ID?

To enable the Google Analytics User ID follow the steps below:
#1 Navigate to the Admin section of your GA Property and then click on the ‘user ID’ link under ‘tracking info’ drop-down menu.
#2 Read and agree to the user ID policy by toggling the blue switch to ‘ON’ and then click on the ‘Next Step’ button.
#3 Read and agree to the user ID policy by toggling the blue switch to ‘ON’ and then click on the ‘Next Step’ button.
#4 Click on the ‘Create’ button to create a new user ID view.
#5 Select your app (Website or Mobile App) for the User ID view.
#6 Name your new reporting view and select your ‘reporting time zone’.
#7 Click on the ‘Create View’ button.

What is the difference between User ID and Client ID?

A client ID represents a unique device/browser. Whereas a user ID represents a unique user that may interact with your website using multiple devices/browsers.

Is User ID same as email address?

No. User ID is usually the login ID. However, the login ID should not contain personally identifiable information (PII) like name, email address, etc as it is against Google Analytics Terms of Service.

Register for the FREE TRAINING...

"How to use Digital Analytics to generate floods of new Sales and Customers without spending years figuring everything out on your own."



Here’s what we’re going to cover in this training…

#1 Why digital analytics is the key to online business success.

​#2 The number 1 reason why most marketers are not able to scale their advertising and maximize sales.

#3 Why Google and Facebook ads don’t work for most businesses & how to make them work.

#4 ​Why you won’t get any competitive advantage in the marketplace just by knowing Google Analytics.

#5 The number 1 reason why conversion optimization is not working for your business.

#6 How to advertise on any marketing platform for FREE with an unlimited budget.

​#7 How to learn and master digital analytics and conversion optimization in record time.



   

My best selling books on Digital Analytics and Conversion Optimization

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and Beyond
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.

Himanshu Sharma

Digital Marketing Consultant and Founder of Optimizesmart.com

Himanshu helps business owners and marketing professionals in generating more sales and ROI by fixing their website tracking issues, helping them understand their true customers' purchase journey and helping them determine the most effective marketing channels for investment.

He has over 12 years of experience in digital analytics and digital marketing.

He was nominated for the Digital Analytics Association's Awards for Excellence. The Digital Analytics Association is a world-renowned not-for-profit association that helps organisations overcome the challenges of data acquisition and application.

He is the author of four best-selling books on analytics and conversion optimization:

error: Alert: Content is protected !!