Analytics and Tracking

First-Party Cookie

Also called 1P cookie

One set under the same domain the visitor is browsing, so the browser treats it as the site's own housekeeping.

Quick facts: First-Party Cookie

Category
Analytics and Tracking
Also called
1P cookie
Level
Beginner
Affects
Logged-in sessions, analytics accuracy, returning visitor counts
Where to see it
Browser developer tools storage panel, GA4 settings, Google Tag Manager
In this article4
  1. How a first-party cookie works
  2. Why first-party cookies matter
  3. Where first-party cookies go wrong
  4. What to do about it

The browser decides what kind of cookie it is looking at by comparing two things: the domain in the address bar and the domain that set the cookie. When they match, the cookie is first-party. Your shop sets a basket cookie, your site sets a login session, your analytics tag writes an identifier under your own domain — all first-party, because the visitor is on your site at the time.

This is a matter of context, not ownership. The same analytics vendor’s script can produce a first-party cookie on your site and a third-party one elsewhere. What matters is whose address bar the visitor is looking at when the cookie is written. That single test is what separates a cookie the browser treats as ordinary housekeeping from one it treats with suspicion.

Why first-party cookies matter

Browsers have spent years tightening the rules on cookies set by other domains while leaving first-party cookies largely intact. If your measurement depends on a first-party identifier, more of it survives, and it survives in more browsers. That is the whole reason server-side tagging and custom tagging subdomains exist.

They also carry the parts of a site that cannot be given up. A basket, a signed-in state, a saved language, a form that remembers half-typed answers — none of these work without a cookie set by the site itself. This is why blanket advice to “turn off cookies” is unhelpful for a business: the question is never whether to use them, but which ones need permission first.

Where first-party cookies go wrong

The most common misunderstanding is that first-party means permanent. It does not. Safari shortens the life of cookies written by scripts rather than by the server, so an analytics identifier can expire long before its stated date and a returning visitor is counted as a new one. Being first-party helps; it is not immunity.

The second is assuming first-party means consent is not required. It is the purpose that decides. An advertising identifier stored under your own domain is still an advertising identifier, and it belongs behind the banner along with everything else that is not needed to make the page work.

The third is a subdomain mismatch. Set a cookie on the main site and read it from a booking system on a different domain and you have two disconnected visitors, one journey, and a report that makes no sense.

What to do about it

Check which of your cookies really are first-party by opening the site in a private window and reading the domain column in the browser’s storage panel. Anything written under a vendor domain is a third-party cookie, whatever the plugin’s marketing said.

Where measurement matters and Safari traffic is significant, look at whether the identifier is being written by the server rather than by a script, since that is what decides how long it lives. And keep any booking engine, help desk or payment step on the same root domain wherever the platform allows it — a shared root domain is the cheapest fix available for broken analytics and tracking, and it needs no extra infrastructure at all.

Do and do not

Do

  • Check the domain column to confirm a cookie really is first-party
  • Keep booking and checkout steps on the same root domain
  • Set measurement identifiers from the server where you can

Do not

  • Assume first-party means consent is unnecessary
  • Assume the stated expiry date will be honoured
  • Split a customer journey across two unrelated domains

Questions people ask about this

Is a first-party cookie exempt from consent rules?

No. Consent depends on what a cookie is for, not on which domain set it. A session cookie that keeps someone logged in is necessary and needs no permission. An advertising or analytics identifier stored under your own domain still needs consent, because the page would work perfectly well without it.

How long does a first-party cookie last?

As long as the expiry date it was given, unless the browser overrides that. Safari in particular shortens cookies written by JavaScript, so a stated expiry far in the future can be cut to days. Cookies set by the server in the HTTP response are treated more generously, which is why server-side setups keep identifiers alive longer.

Will my analytics be accurate if I only use first-party cookies?

More accurate than relying on third-party ones, but not complete. Visitors who decline consent, clear their storage, or move between a phone and a laptop will still appear as separate people. Use first-party cookies for the best available picture, then sanity-check the totals against something countable like enquiries or orders.

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.