Demos and colabs walk you through the Privacy Sandbox APIs.
There are a number of demos available for the Privacy Sandbox APIs. Most of them will require you to be familiar with the APIs, so if you haven't read the docs, check out the links we've listed along with the demos.
Demos and colabs
Protected Audience API
The demo uses the Protected Audience API to join ad interest groups on two advertiser sites, and then initiates an on-device auction to select an ad for display on a publisher site.
Topics API
With the Topics API, a user's device observes and records topics that appear to be of interest to the user based on their activity. The API then allows callers (such as ad tech platforms) to access these topics without revealing other information about the user's activity. The following resources provide examples of the API in action.
Resources for Topics on the Web
- Headers demo: This is a recommended, more performant approach.
- JavaScript demo: Use JavaScript Topics methods if you can't modify headers.
- Topics API colab: Experiment with the TensorFlow Lite model used by Chrome to infer topics from hostnames.
- Topics documentation for the Web: Learn more about how Topics work and how to implement it.
Resources for Topics on Android
- Sample apps: Refer to Kotlin sample app or Java sample app to guide your integration.
- Topics API colab: Test different combinations of app info against the topics classifier model.
- Topics documentation for Android: Learn how Topics works on Android.
Attribution Reporting
The Attribution Reporting API enables advertisers and ad tech providers to measure conversions for ad clicks and views, ads in a third-party iframe, and ads in a first-party context. In this demo an advertiser uses an ad tech provider to run their ads on a publisher site.
Demo
Noise Lab
When aggregatable reports are batched by a collector and processed by the aggregation service, random data is added to the resulting summary reports in order to protect user privacy. Use Noise Lab to experiment with different values to see the impact of noise.
Aggregation Service
The Aggregation Service is responsible for decrypting and combining collected data from aggregatable reports, adds noise, and returns a final summary report. This is all accomplished within a trusted execution environment (TEE).
Colabs
Shared Storage
The Shared Storage API provides storage that can be used cross-site, meaning you store a value at one domain, then read the value from another domain. You can set data freely, but are restricted in how you get data out of storage. This demo illustrates how it works.
CHIPS
Cookies Having Independent Partitioned State (CHIPS) allows developers to opt a cookie into partitioned storage, with separate cookie jars per top-level site, improving user privacy and security. This demo illustrates how it works.
Related Website Sets
Related Website Sets is a way for a company to declare relationships among sites, so that browsers allow limited third-party cookie access for specific purposes. Chrome will use these declared relationships to decide when to allow or deny a site access to their cookies when in a third-party context.
- Demo
- Submission JSON generator.This tool generates the JSON resources needed to make a Related Website Sets (RWS) submission.
- Docs
Permissions Policy
Permissions Policy allows the developer to control the browser features available to a page, its iframes, and subresources, by declaring a set of policies for the browser to enforce. This demo lets you try out the available policies.
User Agent Reduction
User-Agent reduction minimizes the identifying information shared in the User-Agent string, which may be used for passive fingerprinting. Resource requests have a reduced User-Agent header now and the return values from certain Navigator interfaces are reduced. This demo lets you experiment with the new UA string values.
Private State Token API
With the Private State Token API, a website can issue cryptographic tokens to a user it trusts, which can later be used elsewhere. The tokens are stored securely by the user's browser, and can then be redeemed in other contexts to confirm the user's authenticity. Check out the API in this demo.
Privacy Sandbox Demos Framework
Privacy Sandbox Demos framework offers cookbook recipes, sample code, and demo applications, based on Privacy Sandbox APIs. These are intended to aid businesses and developers in adapting their applications and the businesses they support to a web ecosystem without third-party cookies.
Use case | Description | APIs |
---|---|---|
Retargeting / Remarketing | How to show relevant ads to a user who has researched a brand or product online. | Protected Audience API Fenced Frame |
Single-touch conversion Attribution | How to measure conversion after seeing ads on a news site and buying a product on an online shopping site. | Attribution Reporting API |
Instream VAST video ad in a Protected Audience single-seller auction | Provides details on a temporary solution allowing Top Level embedded video players access to the VAST XML URL. | Protected Audience API |
Instream VAST video ad in a Protected Audience sequential auction setup | Shows one of the ways that VAST XMLs can be handled in a Protected Audience sequential auction setup when the ad is rendered in an iframe. | Protected Audience API |