Analytics and Tracking

Client ID

Also called cid

A random ID that Google Analytics stores in the _ga cookie to recognise the same browser on later visits.

Quick facts: Client ID

Category
Analytics and Tracking
Also called
cid
Level
Intermediate
Affects
User counts, new versus returning users, attribution, data protection
Where to see it
Browser developer tools (the _ga cookie), GA4 DebugView, GA4 user explorer, Google Tag Manager
In this article4
  1. How the client ID works
  2. Why it matters
  3. Common mistakes
  4. How to act on it

A client ID is a random identifier that Google Analytics generates on a browser’s first visit to your site and keeps in a cookie on your own domain, which lets it tell when the same browser returns. In the data sent to Google it travels as the cid parameter, which is why tracking guides often call it that.

How the client ID works

When GA4 runs on a page for the first time in a browser, it sets a cookie called _ga on your domain. Its value looks something like GA1.1.1234567890.1759572000. The last two blocks, a random number and the time of the first visit, together form the client ID. Every event that browser sends afterwards carries the same ID, which is how GA4 knows that the person reading your pricing page today is the visitor who came from a Google ad last week.

A client ID belongs to a browser on a device, not to a person. The same customer on their phone, their work laptop and their tablet has three client IDs, and clearing cookies or using a private window produces a fresh one. GA4 calls this the device ID and counts users by it, unless you also send a user ID for logged-in visitors and your reporting identity is set to use it.

The cookie lasts up to two years by default and is renewed on each visit, but browsers cut that short. Safari’s Intelligent Tracking Prevention limits cookies set by scripts to seven days in many cases, so an iPhone visitor who returns after a fortnight is often counted as a new user.

Why it matters

Almost every user-level figure in GA4 rests on the client ID: new versus returning users, how many visits come before a purchase, which channel first brought someone in. Knowing its limits stops you over-reading those numbers. A jump in new users can simply mean more Safari traffic or more people rejecting cookies, not more new people.

It also has a legal side for UK businesses. UK GDPR names online identifiers among the things that can make data personal, and a client ID exists precisely to single out one browser, even though it carries no name. That is why the _ga cookie should wait for the visitor’s consent before it is set, why you should never send names or email addresses into GA4 alongside it, and why GA4’s tools for deleting an individual’s data look them up by client ID.

Common mistakes

  • Reading users as people. They are browsers, with duplicates across devices and resets after cookie clearing and Safari’s limits.
  • Two set-ups on one site. A GA4 tag in the theme and another in Tag Manager, or two properties with different cookie settings, can split one visitor into two.
  • Losing the ID across domains. If your booking system or shop runs on another domain without cross-domain tracking, the visitor arrives there with a new client ID and the sale is credited to a referral from your own site.
  • Inventing IDs. Sending server events through the Measurement Protocol with a made-up client ID creates phantom users instead of joining the real visitor’s activity.

How to act on it

Find your own client ID: open your site, then your browser’s developer tools, and look for the _ga cookie under Application in Chrome or Storage in Firefox. Knowing it lets you find your own test visits in a user explorer exploration and check what GA4 recorded for them.

Then check three things. Only one GA4 configuration should set the cookie. Cross-domain tracking should cover every domain in the customer journey, including payment and booking pages you control. And your cookie banner should hold the cookie back until the visitor agrees. If customers log in, sending a user ID as well gives a much truer picture of returning customers than the client ID alone.

Reliable visitor identity is part of the groundwork for judging paid campaigns, which is where performance marketing begins: if one buyer looks like three users, every cost-per-user figure is off.

Do and do not

Do

  • Hold the _ga cookie back until the visitor consents
  • Set up cross-domain tracking for every domain in the journey
  • Send a user ID for logged-in customers

Do not

  • Treat GA4 users as a count of people
  • Make up client IDs for Measurement Protocol events
  • Send names or email addresses to GA4 alongside the client ID

Questions people ask about this

Is the client ID the same as the user ID?

No. GA4 creates the client ID automatically for each browser, while a user ID is one you send yourself, usually your own customer reference, when someone logs in. A user ID can join one person's visits across devices; a client ID cannot. Never use an email address or a name as a user ID.

Can I see an individual visitor's client ID in GA4?

Not in the standard reports. The user explorer technique in GA4's Explore section shows individual IDs and their event history, and you can store the client ID as a custom dimension by reading the _ga cookie in Tag Manager. Only do this for a clear purpose, and remember you are then handling identifiers that count as personal data.

What happens to the client ID when a visitor rejects cookies?

No cookie is set, so there is no lasting client ID. With Google's consent mode in its advanced setting, GA4 receives cookieless pings and models some of the missing activity; in basic mode nothing is sent until the visitor agrees. Either way, user counts on a UK site with a compliant banner will be lower than the true number of visitors.

Related terms

Found this useful?

Share it, or ask an AI to summarise it

Back to the glossary

Knowing the term is the easy part

Applying it to your own site and budget is the work. Book a call and I will tell you what actually applies to you.