Analytics and Tracking

_ga Cookie

Also called GA4 client ID cookie

The first-party cookie holding the random client ID that GA4 uses to recognise a browser across visits.

Quick facts: _ga Cookie

Category
Analytics and Tracking
Also called
GA4 client ID cookie
Level
Intermediate
Affects
User and session counts, returning visitors, attribution
Where to see it
Browser developer tools storage panel, GA4 admin, Google Tag Manager
In this article4
  1. What the _ga cookie stores
  2. Why the _ga cookie matters
  3. Where the _ga cookie goes wrong
  4. What to do about it

When the Google tag runs for the first time it generates a random value called the client ID and writes it into a cookie named _ga, under your own domain. Every hit sent afterwards carries that value, which is how GA4 decides that two page views belong to the same browser. Alongside it sits a second cookie, named for the specific data stream, which holds session state — whether a session is running, how many have happened, and what campaign started the current one.

The value is not a name or an email address. It is a meaningless string generated in the browser, with no way to work backwards from it to a person. That is worth knowing before you answer a privacy question about it, because the honest answer is that it identifies a browser, not a human being.

Almost every number you rely on in GA4 depends on it. Users, returning visitors, session counts, the path someone took across several visits before enquiring, and the channel that gets credit for the conversion are all assembled from that one identifier. Lose it and the reporting does not go blank; it goes subtly wrong, which is worse.

The cookie is first-party and is given a long default lifetime — two years unless you shorten it — but the browser decides whether that lifetime is honoured. Because the Google tag writes it with JavaScript, Safari’s tracking prevention can cut it dramatically, so a visitor who returns after a gap gets a brand-new client ID and is counted as a different person.

The most common failure is a customer journey split across domains. Your website sets one _ga cookie; your booking engine or payment page on another domain sets a different one. Without cross-domain measurement configured, one customer becomes two users and the conversion is credited to a referral from your own site.

The second is firing the tag before consent has been answered, then discovering the cookie is already written when the visitor clicks reject. The third is a subdomain mismatch, where the cookie is set narrowly rather than at the root domain, so moving between the main site and a subdomain loses continuity. All three are configuration faults rather than tool faults, and all three are invisible in the reports until somebody looks.

What to do about it

Open your own site in a private window, complete a real journey through to the thank-you page, and watch the _ga cookie in the browser’s storage panel. Confirm it is set at the root domain, that it survives the move into a booking or checkout step, and that it is not written before the consent banner is answered.

Then decide on the lifetime deliberately rather than accepting the default. A shorter period is easier to justify in a privacy policy; a longer one preserves attribution for long buying cycles. Whichever you choose, state the real figure in your cookie table, and treat this as part of a proper GA4 setup rather than something a plugin will handle correctly on your behalf.

Do and do not

Do

  • Check it is set at the root domain, not a subdomain
  • Verify it survives the move into checkout or booking
  • Choose the cookie lifetime deliberately and record why

Do not

  • Let the tag write it before consent is answered
  • Assume the stated expiry survives Safari
  • Treat one client ID as one customer

Questions people ask about this

Is the _ga cookie personal data?

It holds a randomly generated identifier rather than a name or an email address, but under European rules an identifier that singles out a device is still treated as personal data. That means it belongs in your cookie table, it needs consent because analytics is not strictly necessary, and visitors should be able to ask what is held about them.

Why does GA4 count one person as several users?

Because it counts client IDs, and a person can generate several. Different devices, different browsers, a private window, cleared storage, or a cookie shortened by Safari all produce a fresh identifier. Signed-in measurement with your own user ID is the only reliable way to join those visits into one person.

Can I change how long the _ga cookie lasts?

Yes. The Google tag exposes a cookie expiry setting you can shorten, and many consent tools adjust it too. Shortening it reduces how far back returning visitors can be recognised, so attribution for long consideration cycles suffers. Pick a period that matches how long your customers actually take to decide, and record that reason.

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.