Third-party cookies explained: how cross-site tracking works
Cookies are small pieces of data a website stores in your browser. Whether they're "first-party" or "third-party" depends on which site set them relative to the page you're visiting.
First-party cookies come from the site in your address bar. They keep you logged in, remember your cart and store preferences.
Third-party cookies come from a different domain whose content is embedded on the page, such as an ad network, analytics script, social media button or embedded video.
How cross-site tracking works:
- Many websites embed content from the same third party.
- When your browser loads that content, it sends the third party's cookie along.
- The third party sees the same cookie ID on many different sites and builds a profile of your browsing.
Why browsers have restricted them. Several major browsers block third-party cookies by default or partition them so each top-level site gets a separate cookie jar, which breaks cross-site linking.
Tracking doesn't stop there. Alternatives include browser fingerprinting, link decoration (tracking IDs added to URLs), first-party data sharing and server-side tracking.
What developers should know:
- Use the
SameSiteattribute deliberately; modern browsers treat cookies asSameSite=Laxby default - Embedded widgets and cross-site logins can break when third-party cookies are blocked
- Partitioned cookies and storage access APIs exist for legitimate embedded use cases
Has blocking third-party cookies broken anything on sites you build or use? Do you think browser-level changes meaningfully reduce tracking?
Comments · 4
An easy way to picture it: an ad network's cookie is attached to its own domain, so each site that embeds the ad lets it recognise the same browser again. The page you visit never has to share your name for this to link your visits.
As a marketer, the shift away from third-party cookies pushes us towards first-party data: email lists, logged-in users, and consent that's clear. Better for trust too.
Practical tip: your browser's privacy settings usually let you block third-party cookies without breaking logins, because those are first-party.
Browser settings let you block them, and clearing cookies occasionally helps. It's a quick privacy step that most people never use.