News

Client ID vs User ID in Google Analytics

Placeholder

With the advancement of technology, your consumers are able to do research and know everything about your brand. The plus side is that you can do the same. Thanks to Google Analytics, you can gain a better understanding about who your consumers are and their behaviour online.

Google Analytics would be highly limited without the Client ID or the User ID.

We know how Google Analytics gives you the insights to better understand your customer’s journey, evaluate the performance of your website and much more. You will be able to see which pages attracted the most traffic, or how your prospects were able to find your site: was it through social media; or by typing the direct URL? How many new users did you get this month? And did many old visitors come back to your site?

We could not answer any of these questions without the Client ID or the User ID, both of which are used in Google Analytics as forms of user login tracking.

You probably have heard of the two terms, and too often people reference them as the same things. There are however, a few major differences to note between the two.

I’m going to define each term and explain the role and benefits of each. After that, I will summarise the differences and help you to gain a clearer understanding of the kind of data you can gather through the Client ID and the User ID, as well as the differences between the two.

 

What is the Client ID in Google Analytics?

The Google Analytics cookies: cookies not like any others

Craving a Delicious Cookie?

Google Analytics is able to identify first-time users across your website. It does so through the Client ID. Google Analytics stores it in a cookie called the “__ga” cookie. This cookie is set on your user’s browser when he or she visits your site for the first time. How? GA generates a unique and random Client ID with each hit associated with a user.

The Client ID will create a record each time you have a new visitor on your site. Since a cookie generates it, it will last for the time the cookie lives – ie: 2 years. However, what you should always keep in mind is that if your user clears his or her cache, it will delete the cookie and this means that your Client ID will also disappear.

Moreover, remember that cookies are also set on a specific device and browser. This means that if you access my website through Google Chrome, via your laptop, it will only place the cookie there. Because of this, by default, even if the same user is accessing your site through different browsers or devices, he or she will get two different IDs.

Thanks to the Client ID, Google Analytics is able to get user insights and determine attribution modelling. Let me explain those a bit better.

User Insights & Attribution Modelling via Client ID

Now that I have defined what the Client ID is and how it is generated, you should have a good understanding of how new visitors are tracked on your site. However, the Client ID is used for much more than that.

First, it will also allow you to track returning visitors. If your prospects come back to your website through the same browser and on the same device, Google Analytics will recognise their Client ID, and consequently know that it is the same user. Even if they are anonymous (meaning that they haven’t identified themselves), the Client ID will still allow you to track them.

More than merely the number of visitors on your site, the Client ID will also allow you to attribute your prospects to a source. This process is called “attribution modelling”.

By default, Google Analytics applies the last non-direct click model. What does that mean? If one of your users starts a new session, and it doesn’t have any information on the source, it will automatically be applied to the last known source (from the past 6 month).

You may be wondering what the Client ID has to do with this? How do you know if this user not only has another source, but has ever been on your website? Remember that the Client ID will record all of the visits by associating a unique ID. So, if one of your users accesses the site again without a source, Google Analytics will retroactively look for the same ID in its database, and assign the previous source it recorded.

It seems pretty useful doesn’t it? But how exactly can you extract the Client ID?

How do I get the Client ID?

If you want to analyse your own Client IDs, you can easily retrieve them from the GA cookie. To do so, simply use this callback function:

ga(function(tracker)
{ var clientId = tracker.get(‘clientId’);
});

This small snippet of Javascript code will allow you to get your own Client IDs and use them independently from your Google Analytics instance. For example, if you want to store historical data, even if the cookie expires (and therefore the Client ID does too), you can use this callback function to keep track of all active and expired Client IDs.

Now that you understand what the Client ID is, let me explain what the User ID is. Before, finally summarising the differences between the two.

 

The User ID: Keeping Track of your Users Across Devices

In this section, I will explain what the User ID is, and how to implement User ID in your Google Analytics account.

What is the User ID in Google Analytics?

The User ID has the same objective as the Client ID: to identify visitors on your site. However, it aims to recognise users across different browsers and devices, by giving each of them unique IDs.

By default, Google Analytics will only have the Client ID set up. However, if you want a more holistic view of the way individual users interact with your page over their various devices, then you will have to implement the User ID. With it, you will be able to better understand the interactions across devices, from the first touch point, to the conversions.

The User ID feature is composed of:
– A User ID field that will be attributed to each user.
– Cross-device reports.

So, how exactly can you benefit from implementing the User ID? Let me explain this further.

The picture below shows one of the main advantages of the User ID: being able to track users across devices.

Understanding your Users’ Conversion Path and Interactions Across Devices

Without the User ID, it will be hard for you to determine if there is a relationship between sessions on different devices or browsers. You are only able to see the independent points. For example, imagine that I access your website with my phone for the first time. The day after, I decide to purchase one of your products on my computer, and a week later, I lodge in a complaint through my tablet.

The User ID will show you that all of these actions were done by one user: me. Without it, Google Analytics will record three different users, and you wouldn’t be able to understand the relationship between each of these actions, or recognise that only one user was involved in these actions. Actions that previously seemed unrelated, will make a lot more sense to you once you enable the User ID feature.

So, are you ready to implement it? Let’s do it.

How to Set User ID Up in Google Analytics?

You will have to manually setup the User ID, as it is not stored in a cookie and will not be installed by default. This means that you will have to set and send your own User IDs with your analytics hits.

Google gives you a number of guidelines to follow, to make sure you set it up properly. For example, it must not contain any identifiable data, such as the user’s name, email addresses, etc..

To set it up, you will first have to enable it in your Google account. You can find it under “Property”. To locate that, click on “Admin”, select an “Account” and a “Property”. From there, click on “Tracking Info”. You should then see “User ID”.

Once it is done, you will have to implement it in your tracking code, and send User ID data back to Google Analytics. Got it?

Now that you understand what a Client ID and User ID is, you should already know a few key differences between the two. However, let me make it easier for you, and summarise those.

 

Client ID vs User ID in Google Analytics

In this section, I will wrap things up by summarising the main differences between Client and User IDs. Here’s a list to refer to regularly:

1. Browser vs User

As you have seen earlier, the Client ID is stored in a cookie, and therefore only tracks the same user across the same browser and device. On the other hand, the User ID focuses on the user, tracking him or her across a range of devices and browsers.

If you need browser reports to know how many users come through Google Chrome vs Safari, the Client ID is sufficient. However, to understand the relationship between touch points, browsers, and devices, the User ID will capture much better quality data.

The picture below displays the GA code. To implement the User ID, you will have to modify the code and add the User ID code snippet.

Edit the GA code to implement your user ID

2. Cookie vs Human

Another difference you’ve probably noticed, is that you won’t really have to do much work to enable the Client ID. It is automatically generated by the Google Analytics cookie.

On the other hand, the User ID will have to be manually setup by you. It may be more complex and will take a bit more of your time. However, depending on the kind of data you want to collect, it may be worth the effort.

3. Random vs Alphabetical

I have mentioned that the Client ID is generated randomly. If you analyse the ID, you will also notice that it will have the time stamp of the user’s first visit. What about the User ID you ask?

The User ID is a bit different. It is composed with alphabetical characters and doesn’t include any time stamp.

4. Unique Users

The Client ID is not always a reliable source to track unique users. It may count the same user two times or even more, if he or she comes from different browsers or devices.

On the other hand, the User ID will correctly be able to measure unique vs returning visitors. It evaluates this through a range of devices and browsers, counting the same user only once.

In the picture below, you will be able to see how Google Analytics, thanks to the Client and User ID gives you detailed reports on new vs returning visitors, as well as the number of users and sessions.

5. Attribution

Both the Client ID and the User ID can attribute the source. However, here too, the Client ID may wrongly attribute the source, as it does not track across browsers and devices. Let me give you an example.

If I have a user who clicks on a link through Facebook, and accesses my website through Google Chrome on their laptop, the Client ID will create an ID for this user and assign the source to “Facebook”. The next day, the same user clicks on a LinkedIn link through Safari. My Client ID will create a new user with a new source, instead of just updating the old one. The User ID, on the other hand, will see that it is the same user and correctly attribute the new source to my user.

 

In Summary…

You should now know how a Client ID differs from a User ID. The data with a User ID, will help you go further, than with the Client ID. However, setting it up will require some time and effort.

By default, Google Analytics will already allow you to gather a lot of data, on top of the Client ID. But, if you are ready to take it one step further, give it a go. Setup your User ID for a fuller picture of your site traffic and performance.

Want more insightfulness on Google Analytics? You’ve come to the right place: check out our articles on defining your goal conversions in Google Analytics, Big Data for Marketing, Discrepancies between Clicks and Google Analytics sessions and All You Need to Know About The Google Analytics Cookie.