Sub topic 2
Why browsers restrict tracking: Safari, Firefox and Chrome
This chapter assumes you know what a cookie is, how a tag manager fires tags, and how conversions and attribution work at a basic level. It explains why browsers started restricting tracking, what each major browser does, and which of your campaign data changes as a result.
The tracking model browsers are responding to
A third-party cookie is set by a domain other than the site the visitor is looking at. An ad network that loads a pixel on thousands of publisher sites can read its own cookie on every one of them. That lets it build a cross-site profile of one browser.
Browser vendors treat this as a privacy problem for three reasons:
- Visitors rarely know which companies observe them, and cannot easily inspect or remove that tracking.
- The same mechanism that serves a relevant ad can feed data brokers or leak browsing history.
- Third-party cookies are a poor basis for trust. A visitor who consents to one site has not consented to dozens of unseen partners.
The browsers did not all act at the same speed. Safari and Firefox are controlled by companies that do not sell advertising, so they moved first and went furthest. Chrome is built by an advertising company, and it had to weigh the effect on the ad ecosystem. That difference explains most of the timeline below.
Safari and Intelligent Tracking Prevention
Apple introduced Intelligent Tracking Prevention (ITP) in 2017. It has tightened through many releases. These are the rules that matter most for marketers:
- Third-party cookies are blocked by default. Since 2020, Safari blocks all third-party cookies, not only those from domains it classifies as trackers. A retargeting pixel that depends on its own cookie on a publisher site gets nothing back.
- Cookies written by JavaScript are capped at 7 days. A cookie set through
document.cookieexpires after seven days, even if your code asks for 90. If a visitor does not return within seven days, your analytics tag sees a new visitor. - Link decoration is penalized. When a visitor arrives from a domain Safari classifies as a tracker, and the URL carries a click identifier in its query string, script-set cookies are limited to 24 hours.
- Script-writable storage is cleared after inactivity. localStorage and similar storage are deleted after seven days of use of Safari without the visitor interacting with your site.
- Server-set cookies are not exempt. Safari limits cookies set from a server that is disguised as first party, for example through a CNAME record that points a subdomain to a tracker. Cookies set by a server whose IP address does not match the site's can also be capped.
The sharpest effect is on the first-party analytics cookie. Many marketers assume a first-party cookie is safe, and in Safari it is only partly so. The following code looks like it sets a 90-day identifier, but Safari will cut it to seven days.
// Set a first-party cookie from your own domain, only after the visitor has consented.
function setFirstPartyId(consented) {
if (!consented) return;
const id = crypto.randomUUID();
const maxAge = 60 * 60 * 24 * 90; // 90 days requested
document.cookie = `visitor_id=${id}; Max-Age=${maxAge}; Path=/; Secure; SameSite=Lax`;
}In Safari, the visitor's real lifetime for visitor_id is seven days. If they arrive from a decorated link, it may be 24 hours. A cookie set in an HTTP Set-Cookie header by your own server, on your own domain, avoids the script cap. That is one reason chapter 9 covers server-side tracking.
Newer Safari versions also strip known tracking parameters from links in Private Browsing and add fingerprinting protection. Check Apple's current WebKit documentation before relying on a specific behavior, because this area changes with almost every release.
Firefox and Enhanced Tracking Protection
Mozilla turned on Enhanced Tracking Protection by default in 2019. It uses a list of known tracking domains and blocks cookies from them across sites. Mozilla then went further with Total Cookie Protection, which became the default for all users in 2022.
Total Cookie Protection does not rely on a list. It gives each website its own separate cookie jar. A third-party cookie is still allowed to exist, but it is stored in a partition keyed to the top-level site where it was set. An ad network's cookie on news.example is a different cookie from the one on shop.example. The network cannot join the two.
This approach, called state partitioning, matters because it defeats tracking even by domains no one has classified as trackers. It also keeps embedded features working, such as a login widget or a video player, because the cookie still functions inside the site where it was set.
Firefox also blocks known fingerprinting scripts and strips some tracking query parameters. Click identifiers can still reach your site, but this is a feature to test rather than assume.
Chrome and the long path to a decision
Chrome has the largest market share, so its plans mattered most for advertisers. The timeline has several turns:
- 2020: Chrome began treating cookies without a
SameSiteattribute asSameSite=Lax, which stops them being sent on most cross-site requests. It also blocked third-party cookies in Incognito mode. - 2020 to 2024: Google announced it would phase out third-party cookies. It developed replacement tools under the name Privacy Sandbox, and moved the deadline several times.
- January 2024: Google disabled third-party cookies for about 1% of Chrome users as a test.
- July 2024 and after: Google said it would not remove third-party cookies on a fixed schedule, and would instead keep user choice in Chrome settings. Later updates scaled back much of the Privacy Sandbox program.
The practical result is that, at the time of writing, ordinary Chrome still sends third-party cookies unless the user or an administrator blocks them. Do not read this as a reprieve. Safari and Firefox have blocked third-party cookies for years, and Chrome offers partitioning (CHIPS) and the Storage Access API for developers who need embedded state to work in a more privacy-respecting way. Regulators and users still push in the same direction. Chapter 14 covers the Chrome advertising APIs in more detail.
Comparing the three browsers
| Browser | Third-party cookies | Script-set first-party cookies | Main mechanism |
|---|---|---|---|
| Safari | Blocked by default | Capped at 7 days, 24 hours after decorated links from trackers | Intelligent Tracking Prevention |
| Firefox | Partitioned per site, plus tracker blocking | No general cap | Enhanced Tracking Protection and Total Cookie Protection |
| Chrome | Allowed by default, user can block, blocked in Incognito | No cap | SameSite defaults, user choice, Privacy Sandbox |
What this means for marketing data
Browser restrictions affect three things you rely on:
- Retargeting and audience building. An ad platform cannot recognize a returning visitor across sites when the cookie is blocked or partitioned. Audience lists shrink and match rates fall.
- Return-visitor measurement. A visitor who comes back after eight days in Safari looks new. Your "new versus returning" split, and your conversion paths, become skewed.
- Attribution windows. A 30-day click window is meaningless when the identifier lasts a week. The conversion may be recorded, but credited to the wrong source, or to "direct".
Tracking parameters give a partial replacement. A campaign link records where a visit came from, using values you control:
https://example.com/spring-sale?utm_source=newsletter&utm_medium=email&utm_campaign=spring_saleUTM parameters are first-party and survive a cookie block. They only describe one visit, though. They cannot connect two separate visits to one person without another identifier, such as a login.
Common errors to avoid
- Treating "first party" as "unlimited". A first-party cookie set from JavaScript is still capped in Safari.
- Testing only in Chrome. A tag that works in Chrome may silently fail in Safari or Firefox. Test in all three, with default settings.
- Assuming Chrome's delay means no action is needed. A large share of your users already browse with tracking limits, so your data is already incomplete.
- Reading a drop in returning visitors as a drop in loyalty. It is often the seven-day cap at work.
Exercise
Your analytics tag sets a cookie with document.cookie and Max-Age of 90 days. A customer visits from Safari, returns 10 days later and buys. What does your analytics report for that visit, and what is one way to improve it?
Show answer
Safari caps script-set cookies at 7 days, so the cookie has expired when the customer returns. Analytics treats them as a new visitor and cannot connect the purchase to the first visit, so the original source is lost, and the sale may be credited to direct traffic. One improvement is to set the identifier in a Set-Cookie header from your own server on your own domain, which avoids the script cap. Another is to ask the visitor to log in, and use that login as the identifier.
Exercise
Why does Firefox's Total Cookie Protection work against trackers that are not on any block list, while a list-based approach does not?
Show answer
Total Cookie Protection partitions every cookie by the top-level site where it was set, so a third-party cookie on one site cannot be read on another. It does not need to know whether a domain is a tracker. A list-based approach only blocks domains someone has already identified.