docs.rodeo

MDN Web Docs mirror

Topics API

{{DefaultAPISidebar("Topics API")}} {{SeeCompatTable}} {{non-standard_header}} 

[!WARNING] This feature is currently opposed by two browser vendors. See the Standards positions section below for details of opposition.

[!NOTE] An Enrollment process is required to use the Topics API in your applications. See the Enrollment section for details of what sub-features are gated by enrollment.

The Topics API provides a mechanism for developers to implement use cases such as interest-based advertising (IBA) based on topics collected by the browser as the user navigates different pages, rather than collected by the developer by tracking the user’s journey around different sites with third-party cookies.

Concepts and usage

A typical mechanism for advertising on the web involves a user visiting publisher sites that use an advertising technology (ad tech) platform to publish ads for an advertiser’s products or services. The publisher is paid to display the ads, which helps to fund their content, and more business is driven to advertiser sites.

The above process can be made more effective using interest-based advertising (IBA). The idea is that when users visit the publisher sites, they are served a personalized selection of ads based on their interests. Their interests are inferred from sites they have previously visited. In the past, third-party tracking cookies have been used to collect information on user interests, but browsers are phasing out the availability of third-party cookies for an increasing proportion of users. The Topics API provides part of the path towards this goal — a mechanism to implement IBA that does not depend on user tracking.

First of all, the browser infers a user’s interests from the URLs of sites they visit that have ad tech <iframe>s embedded. These interests are mapped to specific topics of interest, and the browser calculates and records the users’ top topic (i.e. the topic that their interests mapped to most often) at the end of each epoch. An epoch is a week by default. The top topic is updated each week so that interests are kept current and users don’t start to see ads for topics that they are no longer interested in.

[!NOTE] This process only happens on sites where a Topics API feature is used (see What API features enable the Topics API?).

Once the browser has observed one or more topics for a user, the Topics API can retrieve them and send them to an ad tech platform. The platform can then use those topics to personalize the ads they serve to the user. The API helps to preserve privacy by only returning topics to an API caller that have been observed by them on pages visited by the current user.

See Using the Topics API for an explanation of how the API works.

What topics are there?

The available top topics that the browser could calculate are stored in a publicly available taxonomy of interests. The initial taxonomy has been proposed by Chrome, with the intention that it becomes a resource maintained by trusted ecosystem contributors. The taxonomy has been human-curated to exclude categories generally considered sensitive, such as ethnicity or sexual orientation.

Interfaces

The Topics API has no distinct interfaces of its own.

Extensions to other interfaces

HTML elements

HTTP headers

Enrollment

To use the Topics API in your sites, you must specify it in a privacy sandbox enrollment process. If you don’t do this, the following sub-features won’t work:

Examples

For complete working examples, see:

Specifications

This feature is not part of an official standard, although it is specified in the Topics API Unofficial Proposal Draft.

Standards positions

Two browser vendors oppose this specification. Known positions are as follows:

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN