Monday, July 22, 2024
No menu items!
HomeData Analytics and VisualizationGoogle Analytics Client ID vs User ID

Google Analytics Client ID vs User ID

If you have ever tried to track additional data about your website’s/application’s users, you probably have stumbled upon the term User ID. In fact, I have two blog posts that teach how to do that – one for Universal Analytics and the other one for Google Analytics 4.

When you read various resources about the User ID, you can notice another term, Client ID. What is it? How client ID is different from the User ID? When should you use what?

In this blog post, I will explain the differences of Google Analytics Client ID vs User ID, and when they are used.

What is Client ID in Google Analytics?

Client ID is the default identifier that Google Analytics uses to distinguish site visitors.

When you install Google Analytics out of the box (without any modifications) and a visitor lands on your page, Google Analytics stores a _ga cookie that contains a thing called Client ID. This is a random number that helps Google Analytics to distinguish the same person across multiple pages of the same website.

An example of a Client ID looks like this:

So, when a visitor lands, he/she gets a cookie with the Client ID. When that same visitor goes from the landing page to some other page of the same site, Google Analytics checks if the cookie with the Client ID exists in the browser. If yes, Google Analytics understands that this is the same device/visitor who was on a previous page, therefore, two page views are stitched and attributed to the same visitor.

This applies to older and newer Google Analytics versions.

If the same person clears cookies in the browser (or visits your site with another browser/device), the cookie with client ID will NOT be persisted, therefore a new cookie with a new randomly generated Client ID will be stored in a browser.

This kind of behavior (limited by technical aspects of how browsers are designed to work) introduces a problem. If a person uses multiple browsers/devices to navigate your website/app, you won’t be able to understand that this is the same person. Client ID on every browser/device is different.

That’s where User ID becomes useful.

Also, on Safari browser (and all iOS browsers), cookie with a Client ID is limited to 7 days (or 24 hours in some cases). If a visitor does not revisit your site within a week, the cookie will be deleted. If a visitor revisits your site after 8 days, a new client ID will be created, thus your reports will start showing a new user (even though this is the same person).


What is User ID in Google Analytics?

User ID is an additional way to tell Google Analytics that two devices/browsers belong to the same user. But this is usable only under one condition – you must have some internal way on your website/application to identify the user. In other words, your website/app must have a signup/login feature.

A person signs up to your website/product and then they create an account. This account must have some ID in your data base. You could use that ID and send it to Google Analytics.

If your website/app has no login and people can use it without signing up, user ID is not an option for you.

You must have some persistent identifier in your data base that developers can make available for your (e.g. in the data layer) so that you could send it to Google Analytics.

I have explained how to send User ID to GA in these two guides: for Universal Analytics and for Google Analytics 4.

User ID is not automatically tracked by Google Analytics. In many cases, you need to cooperate with a developer and ask him/her to make this data available to you (and then you can use that data with Google Tag Manager). Read the two aforementioned guides for more details).

Also, it is important to mention that User ID cannot be an email address, social security number or anything else that can easily identify the person in your reports. This goes against Google Analytics’ terms of service. If IDs in your data base are just some random letters and numbers (e.g. 18bf92n3823bf283), then that’s fine.


Google Analytics Client ID vs User ID: Final Words

So, if we sum up everything I have explained before in this blog post, Client ID:

Is a randomly generated identifier that is stored in a cookie.
It is generated by Google Analytics tracking code. If a visitor clears cookies or uses a different device, a new cookie with new random Client ID is created.
If a visitor uses multiple devices/browsers, you won’t be able to distinguish if it is the same person or not.
On Safari browser (and all iOS browsers), cookie with a Client ID is limited to 7 days (or 24 hours in some cases).

User ID:

Is an ID of a user who has created an account on your website (meaning that you must have this kind of feature on your site).
If you just run a blog where people don’t need to have an account, User ID feature is not for you.
User ID is some ID that is used in your website’s/app’s data base. Every user must have a separate ID. The developers of your website/app are responsible for creating user accounts and giving unique IDs to them.
Google Analytics does not track it automatically and you must do additional configuration. Read more here and here

The post Google Analytics Client ID vs User ID appeared first on Analytics Mania.

Read MoreAnalytics Mania



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments