DEV Community

Weather Clock Dash
Weather Clock Dash

Posted on

Total Cookie Protection: How Firefox's Cross-Site Tracking Defense Actually Works

Total Cookie Protection (TCP) is one of Firefox's most significant privacy features. It's enabled by default in Firefox 103+ and is architecturally different from other tracking protection. Here's what it actually does.

The Problem TCP Solves

Traditional tracking with third-party cookies:

  1. You visit news-site.com
  2. News site loads a tracking pixel from analytics-corp.com
  3. analytics-corp.com sets a cookie in your browser: user_id=12345
  4. Later, you visit shopping-site.com
  5. Shopping site also has an analytics-corp.com pixel
  6. analytics-corp.com reads the same cookie: user_id=12345
  7. analytics-corp.com now knows: user 12345 visited both sites

This cross-site tracking was the foundation of the behavioral advertising industry.

What TCP Does

Total Cookie Protection creates a separate cookie jar for each website.

The key change: cookies are scoped to the site that set them.

With TCP:

  1. You visit news-site.com
  2. analytics-corp.com pixel loads
  3. analytics-corp.com sets a cookie — but it's stored in the news-site.com cookie jar
  4. You visit shopping-site.com
  5. analytics-corp.com pixel loads
  6. analytics-corp.com tries to read its cookie — but it only sees the shopping-site.com cookie jar, which is empty

The cross-site correlation is structurally broken. analytics-corp.com can still track you within news-site.com, but cannot link your identity across sites.

How TCP Differs from Blocking Third-Party Cookies

Chrome's approach (and older Firefox approaches) was to block third-party cookies entirely. This is a blocklist approach:

  • Simple to understand
  • Breaks legitimate uses of third-party cookies (login via Google, some payment flows, single-sign-on)
  • Requires exceptions that become loopholes

TCP's approach is subtler: cookies are isolated rather than blocked.

  • Third-party cookies still work — widgets, embedded content, login flows
  • They just can't track you across sites
  • Fewer breakage issues than full third-party cookie blocking

TCP and Storage

TCP covers all client-side storage for third-party contexts:

  • HTTP cookies
  • localStorage
  • IndexedDB
  • Cache API
  • Broadcast Channel API (isolated per site)

Not just cookies — all the storage mechanisms browsers offer are partitioned.

What TCP Doesn't Cover

Fingerprinting: TCP doesn't prevent scripts from building a fingerprint based on your browser properties. See privacy.fingerprintingProtection in about:config for that.

URL tracking parameters: utm_source=facebook&utm_campaign=summer in URLs are visible regardless of cookies. Firefox strips some tracking parameters from URLs — this is a separate feature from TCP.

First-party tracking: The site you're visiting can still track everything you do within their site. TCP only affects third-party context.

Server-side tracking: The server can track by IP address, timing, and request patterns without cookies at all.

Verifying TCP is Active

Open about:config and check:

network.cookie.cookieBehavior → 5 (TCP enabled)
Enter fullscreen mode Exit fullscreen mode

Value 5 is TCP. Other values:

  • 0: Accept all cookies
  • 1: Block third-party cookies
  • 2: Block all cookies
  • 3: Block cookies from unvisited sites
  • 4: Block cross-site tracking cookies (legacy ETP)
  • 5: Total Cookie Protection (TCP)

If you have Enhanced Tracking Protection set to "Standard" or "Strict", TCP should be active at value 5.

Also check: Settings → Privacy & Security → Enhanced Tracking Protection → should be Standard, Strict, or Custom with "Cookies: Cross-site and social media trackers" enabled.

How TCP Interacts with Login Flows

A common worry: does TCP break Google Sign-In or other SSO?

Login via third-party (e.g., "Sign in with Google"):

  • This works — when you click Sign in with Google, your browser navigates to google.com
  • As a first-party context (you navigated there), Google can set cookies
  • The authentication token is passed back to the original site via redirect parameters, not cookies

Embedded third-party content that requires login:

  • Some legitimate third-party widgets need to "remember" login state across sites (e.g., embedded forums)
  • TCP may break these in some cases
  • Firefox has a heuristic: if user interaction happens with a third-party embed, TCP allows limited cookie access for that embed to enable login flows

TCP in Context

TCP was the result of Firefox's anti-tracking work that included:

  • Enhanced Tracking Protection (2018) — blocked known tracker domains
  • Redirect tracking protection (2019) — blocked tracking via redirect chains
  • Total Cookie Protection (2021) — partitioned storage for all third-party contexts

The progression moved from "block known bad actors" (blocklist) to "change the fundamental trust model" (partitioning). The latter doesn't rely on a list that can go stale or be evaded.

The Effect on the Ad Industry

TCP, combined with the gradual elimination of third-party cookies in Chrome (different mechanism, same direction), is forcing the ad industry toward:

  • First-party data (you've interacted with their own site)
  • Contextual advertising (show ads relevant to current page content, not user profile)
  • Privacy-preserving attribution (Google's Topics API, Firefox's work on privacy-preserving measurement)

The behavioral advertising model that relied on cross-site tracking is being structurally dismantled. TCP is Firefox's implementation of that shift.

For Developers

If you build applications that use third-party cookies legitimately:

  • Test with TCP enabled (it's the Firefox default)
  • Storage Partitioning API (partitioned cookie attribute) is the standards-based way to handle this case
  • document.requestStorageAccess() API allows requesting first-party storage access from third-party context — Firefox supports this for legitimate embedded use cases

The Storage Access API gives legitimate third-party embeds a way to request access to their original cookie jar, with user permission. TCP is thus not a total blocker for valid cross-site use cases — just requires proper opt-in.

Top comments (0)