API Topics per il web

L'API Topics consente la pubblicità basata sugli interessi senza utilizzare cookie di terze parti.

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 app cats.
  • 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.
  • 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 or Sports/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 topic Sports/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.
Diagram showing that the Topics API only marks the topics as observed if the callers has presence in the context.
The Topics API marks the topics observed only by the callers that have presence in the context of these topics. The callers will only be able to access the topics they have observed.

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.

Argomenti sul web nella pratica

Sul web, gli argomenti vengono dedotti dai nomi host delle pagine visitate dall'utente. Ad esempio, l'argomento dedotto per il sito web dogs.example potrebbe essere /Animali e animali domestici/Animali domestici/Cani.

Il seguente diagramma mostra un esempio semplificato che dimostra in che modo l'API Topics può aiutare una piattaforma di tecnologia pubblicitaria a selezionare un annuncio appropriato. L'esempio presuppone che il browser dell'utente abbia già un modello per mappare i nomi host dei siti web agli argomenti.

Diagramma che mostra le fasi del ciclo di vita dell'API Topics, dal momento in cui un utente visita i siti web alla visualizzazione di un annuncio.
Il diagramma del ciclo di vita dell'API Topics illustra le fasi delle azioni dell'API da un punto di vista generale.

Il browser determina l'origine del chiamante dal contesto del codice che chiama l'API Topics. In pratica, ciò significa che gli utenti di Topics chiamano l'API in un iframe dalla loro origine o includono gli argomenti in un recupero alla loro origine.

Ad esempio, una Supply-Side Platform (SSP) può essere incorporata su più siti di publisher. L'SSP potrebbe quindi chiamare l'API Topics all'interno di un iframe dalla sua origine, consentendo di osservare gli argomenti associati a un utente sui siti di questi publisher. Questi argomenti potrebbero poi essere condivisi con una Demand-Side Platform (DSP) per aiutarla a selezionare un annuncio pertinente per l'utente.

In che modo l'API decide quali chiamanti vedono quali argomenti

I chiamanti dell'API ricevono soltanto gli argomenti che hanno osservato di recente e gli argomenti per un utente vengono aggiornati una volta per ogni periodo: un intervallo di tempo impostato su una settimana nell'implementazione di Chrome. Ciò significa che l'API fornisce una finestra temporale in cui un determinato chiamante può ricevere gli argomenti osservati.

La tabella seguente illustra un esempio (sebbene non realisticamente piccolo) di una cronologia di navigazione ipotetica per un utente durante un singolo periodo, che mostra gli argomenti associati ai siti visitati e i chiamanti dell'API presenti su ogni sito (le entità che chiamano document.browsingTopics() nel codice JavaScript incluso nel sito).

Sito Argomenti Chiama dell'API sul sito
running.example Running & Walking
Athletic Shoes
adtech1.example
adtech2.example
dogs.example Dogs adtech1.example
holiday.example Hotels & Accommodations adtech2.example
sunglasses.example Sunglasses [none]

Alla fine del periodo (per impostazione predefinita una settimana), l'API Topics genera gli argomenti più apprezzati del browser per la settimana.

  • adtech1.example può ora ricevere gli argomenti Running & Walking, Athletic Shoes e Dogs perché li ha osservati su running.example e anche su dogs.example.
  • adtech1.example non è idoneo a ricevere l'argomento Hotels & Accommodations per questo utente perché non è presente su alcun sito visitato di recente dall'utente e associato all'argomento.
  • adtech2.example ha visto gli argomenti Running & Walking, Athletic Shoes e Hotels & Accommodations, ma non l'argomento Dogs.

L'utente ha visitato sunglasses.example, che ha l'argomento Sunglasses, ma per questo sito non ci sono state chiamate all'API Topics. Ciò significa che l'argomento Sunglasses non verrebbe restituito dall'API per alcun chiamante.

Nella seconda settimana, l'utente visita un altro sito:

Sito Argomenti Chiama dell'API sul sito
cameras.example Camera & Photo Equipment adtech2.example

Inoltre, il codice di adtech2.example viene aggiunto a sunglasses.example:

Sito Argomenti Chiama dell'API sul sito
sunglasses.example Sunglasses adtech2.example

Oltre a Running & Walking, Athletic Shoes e Hotels & Accommodations della settimana 1, adtech2.example potrà ora ricevere gli argomenti Camera & Photo Equipment e Sunglasses, ma soltanto nel periodo successivo, ossia la settimana 3. In questo modo le terze parti non possono apprendere maggiori informazioni sul passato di un utente (in questo caso un interesse per la moda) rispetto a quelle che apprenderebbero con i cookie.

Dopo altre due settimane, Running & Walking, Athletic Shoes e Hotels & Accommodations potrebbero scomparire dall'elenco di argomenti idonei di adtech2.example, se l'utente non visita siti con questi argomenti contenenti codice di adtech2.example.

I passaggi eseguiti dall'API Topics quando gli utenti visitano i siti che la utilizzano.
In che modo l'API osserva e accede agli argomenti.

Modello di classificazione

Topics utilizza un modello di classificazione che mappa i nomi host dei siti web a zero o più argomenti (l'analisi di informazioni aggiuntive, come gli URL completi o i contenuti delle pagine, potrebbe consentire la visualizzazione di annunci più pertinenti, ma potrebbe anche ridurre la privacy).

Tassonomia

Gli argomenti vengono selezionati da una tassonomia. Questi argomenti sono stati selezionati da Chrome, con l'obiettivo di far diventare la tassonomia una risorsa gestita da collaboratori fidati dell'ecosistema. La tassonomia deve essere abbastanza piccola da associare i browser di molti utenti a ogni argomento. L'obiettivo finale è che la tassonomia provenga da una terza parte che incorpori feedback e idee provenienti da tutto il settore.

Per evitare categorie sensibili, gli argomenti devono essere pubblici, selezionati da persone fisiche ed essere sempre aggiornati. La tassonomia utilizzata da Chrome è stata selezionata da persone fisiche per escludere categorie considerate generalmente sensibili, come etnia o orientamento sessuale.

Classificazione degli argomenti

Gli argomenti vengono selezionati manualmente per 50.000 siti principali e questo elenco di override selezionato di nomi host e argomenti viene utilizzato per addestrare il modello del classificatore. Per i siti principali, gli argomenti vengono visualizzati dall'elenco di override anziché utilizzando il modello di classificazione. Puoi visualizzare l'elenco delle sostituzioni localmente sul tuo computer.

Pagina chrome://topics-internals con il riquadro Classificatore selezionato.
Il riquadro Classificatore della pagina chrome://topics-internals elenca la versione del modello, il relativo percorso e gli argomenti associati a ogni host elencato.

L'implementazione dell'API Topics di Chrome scarica un file TensorFlow Lite che rappresenta il modello in modo che possa essere utilizzato localmente sul dispositivo dell'utente.

Come vengono selezionati i cinque argomenti più apprezzati dall'utente

L'API restituisce un argomento per ogni periodo, fino a un massimo di tre. Se vengono retituti tre argomenti, sono inclusi gli argomenti relativi al periodo corrente e ai due precedenti.

  1. Alla fine di ogni periodo, il browser compila un elenco di pagine che soddisfano i seguenti criteri:
    • La pagina è stata visitata dall'utente durante il periodo in questione.
    • La pagina include codice che chiama document.browsingTopics().
    • L'API è stata attivata (ad esempio, non è stata bloccata dall'utente o da un'intestazione della risposta).
  2. Il browser sul dispositivo dell'utente utilizza il modello del classificatore fornito dall'API Topics per mappare il nome host di ogni pagina a un elenco di argomenti.
  3. Il browser genera un elenco dei cinque argomenti più apprezzati.

    • Ciascuno dei 22 argomenti principali della tassonomia è assegnato a un bucket "utilità elevata" o "utilità standard" in base al feedback dell'ecosistema pubblicitario. Il browser ordina prima gli argomenti in base all'assegnazione ai bucket. Tutti gli argomenti discendenti ereditano l'assegnazione del bucket dell'argomento principale padre. Gli argomenti "Utilità elevata" hanno la priorità.
    • Il browser ordina quindi gli argomenti in base alla frequenza all'interno di ciascun bucket.
    • I cinque argomenti principali di questo elenco ordinato vengono selezionati come argomenti principali dell'utente per l'epoca in questione.

Il metodo document.browsingTopics() restituisce poi un argomento casuale tra i cinque più apprezzati di ogni periodo, con una probabilità del 5% che ognuno di questi possa essere scelto in modo casuale dalla tassonomia completa di argomenti. In Chrome, gli utenti possono anche rimuovere singoli argomenti o cancellare la cronologia di navigazione per ridurre il numero di argomenti restituiti dall'API. Gli utenti possono anche disattivare l'API.

Puoi visualizzare le informazioni sugli argomenti osservati durante l'epoca corrente dalla pagina chrome://topics-internals.

Next steps

Get your environment ready to test and develop web applications with the Topics API.
Check out implementation details and code samples for callers to observe and access topics.

See also

Check out our resources to better understand the Topics API on the Web.