About cookies on this site

We use cookies to collect and analyse information on site performance and usage, to provide social media features and to enhance and customise content and advertisements. Learn more

Cookie settings

About cookies on this site

Cookies used on the site are categorized and below you can read about each category and allow or deny some or all of them. Learn more

Necessary

Some cookies are required to provide core functionality. The website won't function properly without these cookies and they are enabled by default and cannot be disabled.

Preferences

Preference cookies enables the web site to remember information to customize how the web site looks or behaves for each user. This may include storing selected currency, region, language or color theme.

Analytical cookies

Analytical cookies help us improve our website by collecting and reporting information on its usage.

Marketing cookies

Marketing cookies are used to track visitors across websites to allow publishers to display relevant and engaging advertisements. By enabling marketing cookies, you grant permission for personalized advertising across various platforms.

  • Courses
    • Paid courses
    • Course bundles
    • Free courses
  • Blog
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • Services
  • About
    • About
    • Contact
  • Login
  • Courses
    • Paid courses
    • Course bundles
    • Free courses
  • Blog
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • Services
  • About
    • About
    • Contact
  • Login

October 20, 2025

A Guide to Google Analytics Client ID

Updated: October 20th, 2025

If you have landed on this blog post and want to learn about this topic, congratulations. This indicates that you want to go beyond the beginner level. It’s time to go under the hood and understand how Google Analytics generates and uses client IDs.

The Google Analytics client ID is a unique, randomly generated string that GA assigns to a user’s browser or device on their first visit to your website. It’s stored in a first-party cookie named _ga and is the primary mechanism Google Analytics uses to distinguish between new and returning visitors and to link multiple on-site actions to the same user.

In this blog post, I will explain what a Google Analytics client ID is, how it works, its limitations, and many other things.

 

Table of contents

Here’s what you will learn in this article

  • What is Google Analytics client ID?
  • How does the client id work?
  • How to find the client ID?
  • Why would you need to get the GA client ID in the first place?
  • The Limitations of Google Analytics Client ID
  • Differences between client ID and user ID in Google Analytics
  • Final words

 

 

What is Google Analytics client ID?

The client ID is a unique identifier that Google Analytics generates for a browser when a user visits your website. It helps track user interactions and activities during a session, allowing you to understand your audience’s behavior better.

The client ID is generated randomly, and its primary purpose is to distinguish between new and returning visitors, as well as to help organize and aggregate user behavior data (in other words, linking multiple events to the same visitor).

However, it is important to note that the client ID is different from the user ID and has its own set of limitations and use cases. But I’ll talk more about that a bit later.

 

How does the client ID work?

The client ID is stored as a first-party cookie (_ga) on the user’s device or browser when they visit a website with a Google Analytics tracking code. This unique identifier remains persistent and unchanged for up to two years by default (in theory), ensuring that subsequent visits and actions by the same user are recognized and attributed to the same client ID.

However, more and more browsers are limiting the cookie’s lifetime, so in reality, its lifespan is usually shorter.

As the user interacts with the website, Google Analytics collects various data points, such as page views, events, and e-commerce transactions. These data points are tied to the client ID, allowing Google Analytics to aggregate user behavior data. This happens by default.

It is important to note more than once that the client ID is device and browser-specific, meaning it cannot track users across different devices or browsers. If a user visits the same website from different devices or browsers, each instance will generate a separate client ID, and their interactions will be recorded as separate sessions (and users) in Google Analytics.

However, if a visitor navigates from one website (domain) to another, it is possible to unify the client ID by using cross-domain tracking.

Subscribe and Get the Ebook - working with reports in ga4

How to find a Google Analytics client ID?

There are several options to do that.

 

Quick Guide: Choosing the right method to find the client ID

This guide covers several ways to find the Client ID. Use this table to choose the best one for your specific need.

If you need to…

The Best Method to Use Is…

Quickly find your own Client ID for testing purposes. #3: Checking the _ga cookie in your browser’s developer tools.
Look up the journey of a specific, known user by their Client ID. #1: Using the User Explorer report in the GA4 interface.
Capture the Client ID in GTM to send it to a third-party tool (like a CRM). #5: Using the GTAG GET API tag template in Google Tag Manager.
Access the Client ID programmatically for custom development work. #4: Using the gtag(‘get’) command in your website’s JavaScript.
Analyze Client IDs in bulk for advanced data science purposes. #2: Querying user_pseudo_id in BigQuery.

 

#1. Checking in the Google Analytics 4 interface

To locate the client ID in Google Analytics 4, follow these steps:

Log in to your Google Analytics 4 account. Navigate to the Explore section. Click on User Explorer.

Within the User Explorer, you will see the client ID listed for each individual user.

 

#2.Bigquery

In Google BigQuery, every event contains a field called user_pseudo_id. It contains the client ID.

 

#3. Checking a _ga cookie

This option is a bit more technical.

Open the developer tools in your browser (usually accessible via F12 (on Windows) or right-clicking the page and select “Inspect”). Navigate to the Application tab (I am using Google Chrome in this example).

Go to Cookies and select your domain. Then locate the _ga cookie. Its value might look something like this (of course, in your case, the value will be different):

The last two numbers (with a dot between them) are the client id. So if you look at the screenshot above, the client ID value is 40030803.167153367.

If you want/need it, you can access that cookie with Google Tag Manager. In GTM, go to Variables > New > 1st party cookie and enter the following settings (name it exactly as I show in the screenshot below):

This variable will return the full value of the cookie, e.g., GA1.1.40032303.1671533621. If you want to parse just the last two numbers, go to Variables > New > Custom JavaScript and paste the following code (it will work only if you have named the 1st party cookie variable exactly as I did in the screenshot above).

function() {
  return {{ga cookie}}.substring(6)
}

This code will remove the first six characters of the _ga cookie, and the result will be 40032303.1671533621 (or any other numbers that were stored).

Subscribe and Get the Ebook - JavaScript for Google Tag Manager

#4. Using the “get” command in gtag()

Google Analytics 4 tracking code (a.k.a. GTAG) offers a set of commands that you can use for your convenience. One is get that can return values of certain fields/parameters in GA4.

Here’s an example of a command that you can execute right in your Google Chrome console:

gtag('get', 'G-XXXXXX', 'client_id', function(clientId) {console.log(clientId)})

Replace G-XXXXXX with your GA4 property’s measurement ID. Of course, if your developers want to use it, they will need to modify the code (the console.log part) in order to pass the client_id’s value to other parts of your website’s code.

Subscribe and Get the Ebook - Server-side tagging

 

#5. Using a GTAG GET API tag template in Google Tag Manager

This option uses the same get command from the previous tip. But Simo Ahava made this a bit more convenient for Google Tag Manager users. He created a tag template that you can add to your GTM container and then push the values of certain GA fields (including client_id) to the data layer.

In Google Tag Manager, go to Templates > Tag Templates > Search Gallery and locate GTAG GET API template. Add it to workspace.

Then go to Tags > New > Tag Configuration > GTAG GET API. Paste your GA4 measurement ID, name the tag, and save it. Do NOT add a trigger to it.

G-

Then open your existing Google tag (a.k.a. GA4 Config Tag) (if you don’t have it, read this article on how to install GA4 with Google Tag Manager.

In the Advanced Settings of that tag click Tag Sequencing > Fire a tag after GA4 config tag fires and choose the GTAG GET API tag you just created.

Hit the Preview button in GTM. On the Preview mode’s left sidebar, you will start seeing a new dataLayer event that contains the client_id. If you want to use it, create a Data Layer variable for it (client_id).

Important: don’t send the client ID as a Custom Dimension to GA4. Otherwise, it can cause cardinality issues.

 

Why would you need to get the GA client ID in the first place?

Important: Do NOT send client ID as a custom dimension. You might be tempted to capture the Client ID and send it to Google Analytics 4 as an event-scoped or user-scoped custom dimension. You should not do this.

The Client ID is a high-cardinality value, meaning it has a huge number of unique variations (one for almost every user). Sending this as a custom dimension can cause your reports to hit cardinality limits, which results in data being grouped into an “(other)” row, making your reports unusable.

The Client ID is already available in GA4 in the User Explorer report and in BigQuery as user_pseudo_id. Only fetch it for use outside of GA4, such as sending it to your CRM.

I have some examples. But the answer depends on your situation and what you want to achieve. For most GA4 users, fetching the client ID is not needed.

Client ID is required if your company wants to send data to GA4 with measurement protocol. So if your developers want to do this, first, they need to fetch the Client ID and store it somewhere in your database or CRM. After that, they can send events from your server directly to GA4 servers.

Or maybe you are firing some tags in Google Tag Manager (e.g., that submit data to your internal system/CRM), and together with it, you want to pass the GA client ID.

However, again, I want to remind you that you should not send Client ID as an event-scoped or user-scoped custom dimension to GA4. Otherwise, you will be facing high-cardinality issues.

 

The Limitations of Google Analytics Client ID

Even though Client ID is a vital part of Google Analytics, it has some limitations you need to be aware of.

 

Cross-device and cross-browser tracking

The client ID is specific to a particular device and browser. As a result, it cannot track users across different devices or browsers.

If a user visits the same website from different devices or browsers, each instance will generate a separate client ID, and their interactions will be recorded as separate sessions in Google Analytics. This can lead to fragmented data and a less accurate understanding of user behavior.

 

Cookie deletion and blocking

Users can delete or block cookies, resulting in the loss of the stored client ID. In such cases, when the user returns to the website, a new client ID will be generated, and they will be treated as a new visitor by Google Analytics. This can cause discrepancies in tracking returning visitors and affect the accuracy of the data.

 

Differences between client ID and user ID in Google Analytics

Sometimes, Google Analytics users (especially beginners) might confuse user ID with client ID. Even though Google Analytics supports both of them, they serve different purposes.

I talk more about this topic here, but if you are interested in a general overview, here it is.

To make the differences absolutely clear, here is a side-by-side comparison:

Feature Client ID

User ID

What it is An anonymous identifier for a specific browser or device. A non-personally identifiable ID that you assign to a logged-in user.
How it’s generated Automatically by Google Analytics on a user’s first visit Manually by your own system (e.g., your website’s database) after a user authenticates.
Where it’s stored In a first-party cookie (_ga) in the user’s browser. In your own backend system (e.g., CRM or database), and then sent to GA.
Tracking Scope Device- and browser-specific. It cannot track the same user across a laptop and a phone. Cross-device and cross-platform. It allows you to stitch together a user’s journey across multiple devices and browsers.
When to use it Always on. This is the default way GA identifies users. Optional. Only for websites or apps with a login feature where you can generate a persistent ID for each user.

 

Tracking scope

Client ID is used to track individual sessions and interactions on a specific device and browser. It is unable to track users across multiple devices or browsers.

User ID enables cross-device and cross-browser tracking, allowing you to track and analyze user behavior across multiple devices and browsers. This provides a more holistic view of the user’s journey and interactions with your website.

 

Storage

The client ID is generated automatically by Google Analytics and stored as a first-party cookie (_ga) in the user’s browser.

User ID (of a registered user) is stored in your system’s/website’s database and then sent to Google Analytics.

 

Data Accuracy

The accuracy of the client ID can be affected by cookie deletion or blocking, which may result in fragmented data and a less accurate understanding of user behavior.

As the user ID is tied to an authentication system, it is generally more accurate and reliable for tracking user behavior, even if cookies are deleted or blocked.

 

Use cases

The client ID is useful for tracking general user behavior, such as new vs. returning visitors, average session duration, and conversion rates. Even though people can block or delete cookies, the client ID is still useful to tie events of the same visitor to the same session.

The user ID enables more advanced tracking, such as cross-device analysis. However, if your website does not have a login feature, a user ID in GA4 is not for you.

 

Google Analytics Client ID: Final words

And that’s the end of this blog post.

We delved into the world of Google Analytics client ID, examining its role in tracking website user behavior. This article explained the concept of client ID and how it operates. Even though Client ID seems like a small thing, it’s a pretty important part when it comes to aggregating events into sessions and connecting them with a single user.

If you want to find/check the client ID, you can either use the browser’s developer tools (and check the _ga cookie), or you can utilize the GTAG get method.

However, it’s not perfect, so when you think about it, always have a pound of salt with you.

Last, do not confuse the client ID with the user ID. They are different things designed to serve different purposes.

In summary, here are a few final key points to keep in mind:

  • It’s a browser/device identifier: The Client ID tracks a browser, not a person. The same user on a different device will get a new Client ID.
  • It’s stored in the _ga cookie: The Client ID is the core component of the main Google Analytics cookie.
  • It’s not a user ID: A User ID is for logged-in users and allows for cross-device tracking; a Client ID cannot do this.
  • Don’t send it as a custom dimension: Sending the Client ID to GA4 as a custom dimension is strongly discouraged as it will lead to high-cardinality issues and can pollute your reports.
  • Its primary use is connecting data: The main reason to access the Client ID is to send data from other systems (like a CRM) back to Google Analytics.

 

Julius Fedorovicius
In Google Analytics Tips
6 COMMENTS
Anna Sh
  • May 25 2023
  • Reply

Hi Julius,

could you explaine how to config a Ga4 tag configuration with client id? Should I use Fields to set and set client_id and also use User property and set there client_id one more time? Could it be the same name if i set client id in both options: fields to set and user property in configuration tag?

I watched your video about user_id, and you mentioned the name of user id variable have to be diffrent.

    Julius Fedorovicius
    • May 25 2023
    • Reply

    GA4 tracks client id automatically. You don't need to set it.

Anna Sh
  • May 26 2023
  • Reply

Julius,

but if I want to use client id as a custom dimension in different reports in ga4, I should create the custom dimension, but you mentioned it's not correct.

    Julius Fedorovicius
    • May 26 2023
    • Reply

    Custom dimensions in Ga4 should not have more than 500 unique values per day. Otherwise, you will face high-cardinality issues and see a lot of (other) in your reports.

Saurabh Pathak
  • Sep 3 2025
  • Reply

Is there any method to not set the client ID parameter while sending cookieless pings to Google Analytics?

Taras
  • Sep 28 2025
  • Reply

Thanks for this article,Julius.
What if I add client_id as an "Event Parameter" in "Shared event settings" of the GA4 tag and identify it as Scope to User custom parameter in the GA. Will I face high-cardinality issues?
How do you suggest managing that issue, use Big Queries reports or other ways existing?

Leave a comment Cancel reply

Your email address will not be published. Required fields are marked *


 

Hi, I'm Julius Fedorovicius and I'm here to help you learn Google Tag Manager and Google Analytics. Join thousands of other digital marketers and digital analysts in this exciting journey. Read more
Analytics Mania
  • Google Tag Manager Courses
  • Google Tag Manager Recipes
  • Google Tag Manager Resources
  • Google Tag Manager Community
  • Login to courses
Follow Analytics Mania
  • Subscribe to newsletter
Recent Posts
  • Google Tag Manager event tracking – The Guide
  • Microsoft Consent Mode. How to Configure it?
  • DebugView in Google Analytics 4 not working? Here are 18 solutions.
Analytics Mania - Google Tag Manager and Google Analytics Blog | Privacy Policy
Manage Cookie Settings