Topics API demo

This site provides a basic demo of the Topics API.

An iframe with src= (i.e. with the same origin as this page) calls document.browsingTopics(). This iframe is embedded on several sites, to observe topics:

Topics observed will be displayed on this page (see below).

When topics are observed, a fetch() request is made to, including the parameter {browsingTopics: true}. This causes the request to include observed topics in a sec-browsing-topics header. A request like this would normally be used for ad selection but, for the demo, the server responds with any request headers it receives, so that sec-browsing-topics values can be displayed below.

This fetch() demo isn't anything like a real-world implementation: it only serves to show how topics can be included in request headers. Access to topics in headers is supported in Chrome 111 and above. See also:

Try out the demo

  1. Run Chrome Beta 101 (or above) from the command line using the following feature flags:


    Make sure that chrome://flags/#privacy-sandbox-ads-apis is disabled, since the defaults from this will override the command-line flags (in particular, the epoch duration).

  2. Open this page.
  3. Visit each of the sites listed above — it may be easier to use separate tabs for this.
  4. The most popular topics observed for the most recent three epochs will be displayed below, refreshed every second. The epoch length is set to 15 seconds using the flags above (the default length is one week).

If no topics are displayed, navigate repeatedly to the pages listed above.

The list of topics is only updated if there is a change in observed topics.

You may see unexpected results. Topics inference is not deterministic, and there is a 5% chance that a random topic is returned for each epoch.

No topics observed yet: try visiting one of the sites above.

sec-browsing-topics request headers will be displayed here.