Privacy Tools Guide

The Topics API represents Google’s effort to replace third-party cookies with a privacy-conscious alternative for interest-based advertising. As Chrome phases out third-party cookies throughout 2026, the Topics API emerges as a core component of the Privacy Sandbox initiative. Understanding how this API tracks users is essential for developers building privacy-aware applications and for users concerned about their digital footprint.

What Is the Topics API?

The Topics API is a browser-based mechanism that allows websites to access high-level interest categories based on a user’s recent browsing activity without tracking them across sites. Unlike third-party cookies that create persistent identifiers linking behavior across multiple domains, the Topics API operates entirely within the browser and shares only aggregated interest signals.

Google designed this API to satisfy two competing goals: enabling relevant advertising and reducing invasive cross-site tracking. The API surfaces topics like “Fitness,” “Travel,” or “Technology” that represent broad interest categories derived from the domains a user has visited in recent weeks.

When you visit a website, Chrome calculates which topics likely interest you based on your browsing history over the past three weeks. The API then makes these topics available to site operators through a JavaScript API, allowing them to display targeted content without knowing your specific browsing history.

How the Topics API Works

The API relies on a classifier model that categorizes websites into topics. Chrome maintains a database of millions of websites mapped to interest categories, updated periodically as the classifier improves. Each week, the browser determines the top five topics based on the domains visited most frequently during that period.

The tracking mechanism operates on a weekly cycle. Every seven days, Chrome calculates a new set of topics for each user. These topics derive from the domains in the user’s browsing history, weighted by visit frequency and recency. The browser then makes these topics available to websites through the document.browsingTopics() JavaScript method.

The Three-Week Rolling Window

Chrome uses a rolling three-week window to determine topic eligibility. During the first week, the browser observes browsing activity but does not share topics. In the second week, topics from the first week become eligible for sharing. By the third week, the browser can share topics derived from activity two weeks prior.

This delay provides a layer of privacy by preventing real-time tracking. Sites cannot see what you visited minutes or hours ago—only the general topics from your longer-term browsing patterns. However, this also means the API provides somewhat stale data, which advertisers must consider when targeting users.

Technical Implementation

Accessing Topics in JavaScript

The Topics API exposes user interests through a straightforward JavaScript interface:

async function getTopics() {
  // Check if the Topics API is available
  if (!('browsingTopics' in document)) {
    console.log('Topics API not supported');
    return [];
  }

  try {
    // Get topics for the current user
    const topics = await document.browsingTopics();

    return topics.map(topic => ({
      topic: topic.topic,
      version: topic.version,
      configVersion: topic.configVersion,
      modelVersion: topic.modelVersion
    }));
  } catch (error) {
    console.error('Error getting topics:', error);
    return [];
  }
}

// Example usage
getTopics().then(topics => {
  if (topics.length > 0) {
    console.log('User interests:', topics);
    // Send to your ad server for targeting
  }
});

The returned array contains topic objects with category names and version information. The actual topic values correspond to the Taxonomy, a standardized list of approximately 1,000 interest categories maintained by Google.

Example Topic Output

When the API successfully returns topics, you might receive data structured like this:

[
  {
    "topic": "Travel",
    "version": "chrome.1",
    "configVersion": "chrome.1",
    "modelVersion": "20240103"
  },
  {
    "topic": "Technology",
    "version": "chrome.1",
    "configVersion": "chrome.1",
    "modelVersion": "20240103"
  }
]

Server-Side Topic Retrieval

For server-side implementations, the Topics API also supports HTTP header-based topic retrieval:

GET /api/content HTTP/1.1
Host: example.com
Sec-Browsing-Topics: topic=Temperature_Monitoring; version=chrome.1

This allows servers to receive topic information directly without relying on JavaScript execution.

How the Topics API Tracks Users

Despite Google’s privacy-focused framing, the Topics API represents a form of tracking that developers and privacy-conscious users should understand.

The Tracking Mechanism

Unlike third-party cookies that create persistent identifiers, the Topics API tracks through inference. By combining the topics surfaced through the API with knowledge of which users receive which topics, advertisers can build behavioral profiles over time.

Consider this scenario: A user visits several technology news sites and travel booking websites over three weeks. The Topics API surfaces “Technology” and “Travel” topics. An ad network embedded across multiple sites receives these topics when the user visits any participating site. Over time, the network learns that this particular browser instance maintains interests in both categories.

Cross-Site Correlation

The API enables correlation across sites through several mechanisms:

  1. Shared topic exposure: When the same user visits multiple sites using the Topics API, each site receives identical topic information for that user. This allows linking user activity across otherwise unconnected domains.

  2. Time-based patterns: The weekly topic calculation creates temporal patterns. Advertisers can observe topic stability or changes, inferring user lifecycle events (new parents, job changes, relocations).

  3. Topic combinations: While individual topics seem generic, the specific combination of topics revealed about a user creates a more unique signature. A user with topics [“Fitness”, “Organic Food”, “Yoga”] differs from one with [“Fitness”, “Protein Supplements”, “Gym Equipment”].

Data Retention Considerations

Chrome maintains topic history locally, though this data remains on the device. The browser does not transmit historical topic data to external servers. However, the local persistence means that if someone gains access to your device, they could potentially reconstruct your browsing interests over time.

Opt-Out Mechanisms

Users have several options to control or disable Topics API tracking:

Browser Settings

In Chrome, navigate to chrome://settings/adPrivacy to access the Topics API controls. You can disable the API entirely or manage which topics Chrome calculates. Additionally, the setting “Ad topic interests” controls whether topics are shared with websites.

Developer Tools

Chrome DevTools provides debugging for Topics API behavior:

// Check if topics are being calculated
console.log(document.browsingTopics);
// Inspect network headers for Sec-Browsing-Topics

The Network tab in DevTools shows which topics headers are sent with requests.

Privacy Extensions

Several privacy-focused extensions block Topics API access by intercepting the document.browsingTopics() call or modifying headers. uBlock Origin and similar blockers can prevent topic exposure.

Implications for Developers

Migration Considerations

If your application relies on third-party cookies for advertising, the Topics API provides an alternative path. However, the transition requires careful planning:

// Fallback strategy for ad targeting
async function getAdTargetingParams() {
  const topics = await getTopics();

  if (topics.length > 0) {
    // Use Topics API for targeting
    return {
      method: 'topics',
      data: topics.map(t => t.topic)
    };
  }

  // Fallback to contextual targeting
  return {
    method: 'contextual',
    data: getPageContextualTopics()
  };
}

Privacy Compliance

The Topics API has implications for GDPR and similar privacy regulations. Under GDPR, processing of interest categories may require consent. The API includes features for respecting user choices, but developers must implement proper consent management:

async function initializeAds() {
  // Check consent status before accessing topics
  const consent = await getConsentStatus();

  if (consent.privacyAdConsent) {
    const topics = await getTopics();
    configurePersonalizedAds(topics);
  } else {
    configureContextualAds();
  }
}

Privacy Considerations

The Topics API exists in ongoing regulatory scrutiny. The UK’s Competition and Markets Authority has expressed concerns about whether the API truly reduces tracking or simply consolidates Google’s dominance in digital advertising. Privacy researchers continue to analyze whether the API’s privacy protections are sufficient or merely create an illusion of user control.

For users seeking maximum privacy, the Topics API represents one tracking vector among many. Combining API blocking with other measures—using privacy-focused browsers, implementing tracker blockers, and minimizing browser fingerprinting—provides more protection.

The API’s design includes some privacy safeguards: no user identifiers are shared, topics are intentionally generic rather than specific, and the three-week delay prevents real-time tracking. Yet these safeguards create a system that trades explicit tracking for inferred interests—a distinction that may feel meaningless when the end result enables the same advertising targeting.

Built by theluckystrike — More at zovo.one