What are first-party cookies?

A first-party cookie belongs to the website you are visiting. A third-party cookie belongs to a different site, usually one whose content is embedded in the page. Analytics and advertising measurement now depend almost entirely on the first kind.

First-party and third-party

The difference is about whose cookie it is, compared with the page you are on. A cookie whose domain and scheme match the current page is first-party. One from a different domain is third-party.

  • You are on shop.example.com and a cookie is set for example.com: first-party.
  • You are on shop.example.com and an embedded ad script sets a cookie for adnetwork.com: third-party.

Third-party cookies are what let one company follow a browser across many sites, which is why browsers have restricted them. Safari blocks them by default. Google decided in 2025 to keep third-party cookies in Chrome and leave the choice with users.

How first-party cookies are set

There are two ways, and browsers treat them differently:

  • By JavaScript running in the page, through document.cookie. This is how most tags, including the Meta Pixel's _fbc and _fbp cookies and Google's _gcl_* cookies, store their values.
  • By the server, in the HTTP response the browser receives. These can be marked HttpOnly, which means page scripts cannot read them.

Safari's limits

Safari's Intelligent Tracking Prevention limits first-party cookies too:

Cookie Safari's limit
Set by JavaScript Deleted after 7 days without the visitor interacting with your site
Set by JavaScript on a page reached through a link Safari detects as cross-site tracking Capped at 24 hours
Set by a server on your domain Not capped by these rules
Set by a server reached through a third-party CNAME, or on a third-party IP address Capped at 7 days

On iPhone, these protections also reach most other browsers and the in-app browsers inside apps such as Instagram, Facebook and TikTok, because they run on Safari's engine.

What server-side tagging changes

A server-side tagging container on a subdomain of your site can set cookies in its HTTP responses instead of through JavaScript. Google's documentation notes that a tagging server on your own domain can set HttpOnly cookies and more durable cookies, while one on a default third-party domain can only set JavaScript cookies.

The last row of the table still applies. If your tagging subdomain points at another company's infrastructure through a CNAME, or resolves to an IP address Safari treats as third-party, Safari may cap those server-set cookies at 7 days. That is still longer than the 24 hours a JavaScript cookie can get after an ad click, so a server-side setup can hold on to click IDs such as gclid and fbclid for longer in Safari, even where it cannot keep them indefinitely.

Free tool

See how much conversion data your site is losing, in about a minute

Questions

A first-party cookie's domain matches the site you are visiting. A third-party cookie comes from a different domain, usually from content embedded in the page such as an ad or a social widget.

No. Browser restrictions target third-party cookies and cross-site tracking. First-party cookies are still allowed everywhere, though Safari limits how long some of them last.

No. In 2025 Google said it would maintain its current approach of offering users third-party cookie choice in Chrome, and would not roll out a new standalone prompt.

Partly. Cookies set by a server on your own domain avoid the JavaScript limits. But Safari caps cookies at 7 days when the server is reached through a third-party CNAME or on a third-party IP address.

More glossary

Consent mode v2

Google consent mode v2 explained: the four consent types, basic vs advanced mode, what Google requires for EEA traffic, and how it works with server-side tagging.

Conversions API

A conversions API sends conversion events from your server straight to an ad platform, so blocked pixels no longer mean lost conversions. How it works.

Event match quality

Event match quality scores how well your server events can be matched to people on Meta. What it measures, where to find it and the parameters that raise it.

fbclid

fbclid is the click ID Meta adds to links clicked on Facebook and Instagram. What it is, how it becomes the _fbc value, and why to send it with server events.

GCLID, gbraid and wbraid

GCLID is the Google Ads click ID added to your landing page URL. What it does, how gbraid and wbraid differ on iOS, and why it matters for conversion tracking.

Google tag gateway

Google tag gateway serves Google tags from your own domain. What it does, how it differs from server-side Google Tag Manager, and why Google suggests using both.

All glossary

See the conversions you have been missing

Hosted server-side Google Tag Manager on your own subdomain. Per-site pricing, 1M events included, cancel anytime.