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.comand a cookie is set forexample.com: first-party. - You are on
shop.example.comand an embedded ad script sets a cookie foradnetwork.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_fbcand_fbpcookies 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