Interfejs Topics API umożliwia wyświetlanie reklam opartych na zainteresowaniach bez stosowania plików cookie innych firm.
How the Topics API works
The Topics API can be used to observe and provide access to topics that appear to be of interest to the user, based on their activity. The Topics API can then give API callers (such as ad tech platforms) access to a user's topics of interest, but without revealing additional information about the user's activity.
Key concepts
- A topic is a human-readable topic of interest for the current user and is part of the Topics taxonomy.
- A caller is an entity, such as an app, a third-party SDK, a website, or service, that makes a request to the Topics API to observe or access a user's interests.
- A topic is observed by a caller, if the caller made a Topics API request from a web page or app associated with this topic during the past three epochs.
- An epoch is a period of topic computation, which defaults to one week.
- A taxonomy is a hierarchical list of categories, which includes, for example, such categories as
/Arts & Entertainment/Music & Audio/Soul & R&B
and/Business & Industrial/Business Services/Corporate Events
. - Topics are derived using a classifier model that maps user activity to zero or more topics.
Topics API flow core steps
The Topics API lifecycle has three main steps:
- Observe user activity, such as when they visit the web page
https://cats.example/tabby/index.html
or download the appcats
. - Derive topics from user activity, for example
/Pets & Animals/Pets/Cats
. - Access topics previously observed for the user, for example as a signal to select relevant advertising (such as a cat food promotion).
Observe topics
Callers can only access topics of interest that they've observed. A caller observes a topic when they make a Topics API request from a context associated with this topic. To illustrate this concept, consider the following simplified example.
- Suppose there are two Topics API callers: A and B.
- There are two contexts:
- Greenhouse, for example an app named Greenhouse or a website greenhouse.example, associated with the topic
Home & Garden
. - Tennis exercises, for example an app named Tennis Exercises or a website tennis.example, associated with the topic
Sports/Tennis
.
- Greenhouse, for example an app named Greenhouse or a website greenhouse.example, associated with the topic
- Both caller A and B are present in the context of Greenhouse.
- Only the caller B is present in the context of Tennis exercises.
- Assume that no topics were observed for the user before epoch 1, for the sake of simplification.
- The user visits the Greenhouse app, and callers A and B make a Topics API call to record the user visit to the page or app (see the implementation guide suggested in Next steps to find out how to call the Topics API). This record (a hostname or app data) is later used to derive topics of interest. The Topics API will later mark the topic
Home & Garden
as observed by both callers A and B. - The user visits the Tennis exercises app. Only the caller B sends a Topics API request. The Topics API will later mark the topic
Sports/Tennis
as observed by the caller B. - By the end of the epoch, the Topics API refreshes the user's top topics and determines the callers that observed these topics based on user activity.
- Later, when the caller B makes another Topics API call, it can get either
Home & Garden
orSports/Tennis
topic (or, with a 5% chance, a random topic) for this user in the response array. - Caller A can only access the topic
Home & Garden
, as it has never observed the topicSports/Tennis
. This means that a third-party will only learn about a user's topic of interest within the specific context (app or website) where it is present.

Derive topics
Topics derives topics of interest from user activity. The topics are selected from a predefined open-source taxonomy. Once per epoch, Topics refreshes the user's top five topics and the callers that observed them during the epoch. The Topics classifier model derives topics from user activity: hostname for a web page visit, app information on Android.
Caller accesses user's topics of interest
The API returns only topics that have been observed by the caller within the most recent three epochs. A maximum of three topics may be returned to a caller,one topic for each of the three recent epochs (if the caller observed topics for that epoch). The returned topics can be used by the caller to supplement any contextual information and can be combined to help find a more relevant ad for the user.
Epochs
The Topics API must ensure that the topics of interest it provides are kept up to date. The topics are inferred for a user based on their activity during a period of time known as an epoch, one week by default. Each user has their own epochs (epochs are "per user") and the initial start time is randomized.
Once each epoch, the Topics API computes the user's top five topics and determines which callers observed those topics using on-device information. The topic selected for each epoch is randomly selected from the user's top five topics for that time period. To further enhance privacy and ensure that all topics may be represented, there is a 5% chance the topic is randomly selected from all possible topics in the taxonomy of interests.
Tematy dotyczące internetu w praktyce
W internecie tematy są określane na podstawie nazw hosta stron, które odwiedza użytkownik. Na przykład temat wywnioskowany dla witryny dogs.example może być /Zwierzęta domowe/Zwierzęta domowe/Psy.
Na diagramie poniżej przedstawiono uproszczony przykład, który pokazuje, jak interfejs Topics API może pomóc platformie adtech w wybieraniu odpowiedniej reklamy. W tym przykładzie zakładamy, że przeglądarka użytkownika ma już model do mapowania nazw hostów witryn na tematy.

Przeglądarka określa pochodzenie wywołującego na podstawie kontekstu kodu wywołującego interfejs Topics API. W praktyce oznacza to, że użytkownicy Topics wywołują interfejs API w elemencie iframe ze swojego źródła lub uwzględniają tematy w zapytaniu fetch do swojego źródła.
Na przykład platformę dostawców reklam (SSP) można umieścić w wielu witrynach wydawców. Mogłaby ona wtedy wywołać interfejs Topics API w elemencie iframe ze swojego źródła, co pozwoliłoby jej obserwować tematy powiązane z użytkownikiem w witrynach tych wydawców. Te tematy można następnie udostępnić platformie DSP, aby ułatwić jej wybór odpowiedniej reklamy dla użytkownika.
Jak interfejs API określa, którzy wywołujący widzą które tematy
Interfejsy API otrzymują tylko tematy, które były niedawno obserwowane. Tematy dla użytkownika są odświeżane raz na każdą epokę, czyli okres czasu ustawiony w Chrome na tydzień. Oznacza to, że interfejs API udostępnia ruchome okno, w którym wywołujący może otrzymywać obserwowane tematy.
Poniższa tabela zawiera przykład (choć nierealistycznie mały) hipotetycznej historii przeglądania użytkownika w jednym okresie, pokazując tematy powiązane z odwiedzonymi przez niego witrynami oraz wywołania interfejsu API występujące w każdej z nich (czyli podmioty, które wywołują funkcję document.browsingTopics()
w zawartej w witrynie treści JavaScript).
Witryna | Tematy | Wywołujący interfejs API w witrynie |
---|---|---|
running.example | Running & Walking Athletic Shoes |
adtech1.example adtech2.example |
dogs.example | Dogs |
adtech1.example |
holiday.example | Hotels & Accommodations |
adtech2.example |
sunglasses.example | Sunglasses |
[brak] |
Na koniec okresu (domyślnie 1 tydzień) interfejs Topics API generuje najpopularniejsze tematy przeglądarki w danym tygodniu.
- adtech1.example może teraz otrzymywać tematy
Running & Walking
,Athletic Shoes
iDogs
, ponieważ zostały one zaobserwowane w running.example i dogs.example. - adtech1.example nie kwalifikuje się do wyświetlania tematu
Hotels & Accommodations
temu użytkownikowi, ponieważ nie jest on obecny na żadnej z witryn, które użytkownik ostatnio odwiedził i które są powiązane z tym tematem. - Usługa adtech2.example widziała tematy
Running & Walking
,Athletic Shoes
iHotels & Accommodations
, ale nie widziała tematuDogs
.
Użytkownik odwiedził stronę sunglasses.example, która ma temat Sunglasses
, ale w tej witrynie nie było wywołań interfejsu Topics API. Oznacza to, że interfejs API nie zwróci tematu Sunglasses
dla żadnego wywołującego.
W drugim tygodniu użytkownik odwiedza inną witrynę:
Witryna | Tematy | Wywołujący interfejs API w witrynie |
---|---|---|
cameras.example | Camera & Photo Equipment |
adtech2.example |
Dodatkowo do pliku sunglasses.example
dodawany jest kod z adtech2.example:
Witryna | Tematy | Wywołujący interfejs API w witrynie |
---|---|---|
sunglasses.example | Sunglasses |
adtech2.example |
Oprócz Running & Walking
, Athletic Shoes
i Hotels & Accommodations
z tygodnia 1 usługa adtech2.example będzie teraz mogła otrzymywać tematy Camera & Photo Equipment
i Sunglasses
, ale dopiero w następnej epoce, czyli w tygodniu 3. Dzięki temu firmy zewnętrzne nie mogą dowiedzieć się więcej o przeszłości użytkownika (w tym przypadku o jego zainteresowaniu modą) niż w przypadku korzystania z plików cookie.
Po kolejnych 2 tygodniach Running & Walking
, Athletic Shoes
i Hotels & Accommodations
mogą zniknąć z listy dostępnych tematów adtech2.example, jeśli użytkownik nie odwiedzi żadnych witryn z tymi tematami, które zawierają kod z adtech2.example.

Model klasyfikatora
Topics korzysta z modelu klasyfikatora, który mapuje nazwy hostów witryn na zero lub więcej tematów (analiza dodatkowych informacji, takich jak pełne adresy URL lub zawartość strony, może pozwolić na wyświetlanie trafniejszych reklam, ale może też naruszać prywatność).
Taksonomia
Tematy są wybierane z taksonomii. Tematy te zostały wybrane przez zespół Chrome z myślą o tym, aby taksonomia stała się zasobem utrzymywanym przez zaufanych twórców z ekosystemu. Taksonomia musi być na tyle mała, aby wiele przeglądarek użytkowników było powiązanych z każdym tematem. Ostatecznym celem jest taksonomia dostarczana przez podmiot zewnętrzny, który uwzględnia opinie i pomysły całej branży.
Aby uniknąć kategorii o charakterze kontrowersyjnym, tematy muszą być publiczne, wyselekcjonowane przez ludzi i aktualne. Taksonomia używana przez Chrome została przygotowana przez ludzi w taki sposób, aby wykluczyć kategorie uznawane za wrażliwe, takie jak pochodzenie etniczne czy orientacja seksualna.
Klasyfikacja tematów
Tematy są ręcznie wybierane w przypadku 50 tys. najpopularniejszych witryn, a ta lista hostów i tematów jest używana do trenowania modelu klasyfikatora. W przypadku najpopularniejszych stron tematy są pobierane z listy zastąpień, a nie z modelu klasyfikatora. Listę zastąpień możesz wyświetlić lokalnie na komputerze.

chrome://topics-internals
Klasyfikator znajdziesz wersję modelu, jego ścieżkę oraz tematy powiązane z każdym z wymienionych hostów.Implementacja interfejsu Topics API w Chrome pobiera plik TensorFlow Lite reprezentujący model, aby można było go używać lokalnie na urządzeniu użytkownika.
Jak wybierane są 5 najpopularniejszych tematów użytkownika
Interfejs API zwraca 1 temat na każdą epokę (maksymalnie 3 tematy). Jeśli zwrócone zostaną 3 tematy, będą one obejmować tematy z bieżącej ery i 2 poprzednich.
- Na koniec każdej ery przeglądarka tworzy listę stron spełniających te kryteria:
- Strona została odwiedzona przez użytkownika w okresie epoki.
- Strona zawiera kod wywołujący funkcję
document.browsingTopics()
. - interfejs API został włączony (np. nie został zablokowany przez użytkownika ani przez nagłówek odpowiedzi);
- Przeglądarka na urządzeniu użytkownika korzysta z modelu klasyfikatora udostępnianego przez interfejs Topics API, aby mapować nazwę hosta każdej strony na listę tematów.
Przeglądarka wygeneruje listę 5 najpopularniejszych tematów.
- Każdy z 22 tematów głównych w taksonomii jest przypisany do grupy o „wysokiej przydatności” lub „standardowej przydatności” na podstawie opinii z ekosystemu reklamowego. Przeglądarka najpierw sortuje tematy według przypisania do puli. Wszystkie tematy potomne dziedziczą przypisanie do puli swojego tematu głównego nadrzędnego. Tematy o „wysokiej przydatności” mają wyższy priorytet.
- Następnie przeglądarka sortuje tematy według częstotliwości w każdej grupie.
- 5 najpopularniejszych tematów z tej posortowanej listy jest wybieranych jako najpopularniejsze tematy użytkownika w danej epoce.
Następnie metoda document.browsingTopics()
zwraca losowy temat z 5 najpopularniejszych w każdej epoce. Szansa, że dowolny z nich zostanie wybrany losowo z pełnej taksonomii tematów, wynosi 5%. W Chrome użytkownicy mogą też usuwać poszczególne tematy lub czyścić historię przeglądania, aby zmniejszyć liczbę tematów zwracanych przez interfejs API. Użytkownicy mogą też zrezygnować z korzystania z interfejsu API.
Informacje o tematach obserwowanych w bieżącej epoce znajdziesz na stronie chrome://topics-internals
.
Dalsze kroki
Konfiguracja
Wdrażanie tematów
See also
Check out our resources to better understand the Topics API on the Web.
- Check out Topics demos, collab and walkthrough videos.
- See the list of Chrome flags that allow developers to customize the Topics API for testing.
- See how users and developers can control the API.
- Check out the resources for technical explainers and support. Ask questions, engage and share feedback.