For many users who work with Google Analytics on a basic level, Client ID and User ID may seem like the same thing. However, this is a misconception. Let’s explore why this confusion arises and clarify the actual difference between these two terms.
The basics of user identification in tracking systems. Every tracking system identifies its users by assigning unique identifiers to distinguish them over time. Typically, this is done by writing data into the user’s cookies, which we’ve previously discussed in one of our articles. Now, let's go over the core terms and concepts for each system.
What is Client ID?
Client ID is an automatic user identification method in Google Analytics. It records an ID in the browser’s cookies and stores it for up to two years.
By definition, Client ID is tied to the browser. So logically, Google Analytics should provide statistics based on browsers, not users. While this may seem correct at first glance, it's not entirely accurate, and many analysts are mistaken on this point.
👉 Google Analytics does combine user data through Client ID, especially when users are logged into their Google accounts and personalized settings are applied.
Reports like these prove that Client ID can aggregate user data:
- device overlap reports;
- multi-channel funnels.
Client ID is recorded in cookies in the “_ga” field, with a format like this:
GA1.*.**********.**********
There are various opinions online about the first two parameters, but none of these are officially confirmed by Google Analytics developers. The actual Client ID consists of two sets of 10 digits, separated by a period - **********.**********.
In Google Analytics 4, the format of Client ID looks like this:
While there’s no comprehensive official documentation for the GA4 Client ID yet, you can extract this data from site cookies and use it for uploads and cross-analytics setup.
Client ID - a universal solution?
When it comes to Client ID as a universal solution, Google is working towards perfection. However, there are still limitations because not everyone uses a logged-in Google account. This is precisely why User ID was developed as an optimal solution.
What is User ID?
User ID is a unique user identifier assigned by the website administrator through their own algorithms.
This value is usually anonymous, is not stored in cookies, and is used in projects that can independently identify users. Some companies even use User ID to send data to their CRM system for easier tracking.
According to Google Analytics developers, the User ID feature allows for more accurate user identification since it is manually assigned when the user is authenticated or defined. Additionally, it synchronizes behavior across different devices, further enhancing identification.
How to pass User ID to Google Analytics
To pass User ID to Google Analytics, you simply need to add the following code to gtag.js:
gtag('set', {'user_id': 'USER_ID'})
If you’re using Google Tag Manager, tracking User ID requires:
- adding an extra field within the Google Analytics tag - userId;
- organizing the transfer of the userId variable through the Data Layer.
This ID must be assigned every time the user visits, regardless of the device, so that the data is linked and seen as a single user in the future.
It may sound complicated, but it works. We hope this material has been helpful to you. See you next time on our blog!