# Protected Audience (formerly known as FLEDGE) Integration Guide for Measurement Providers

As part of the [Privacy Sandbox](https://privacysandbox.com/), Chrome proposed
[Protected Audience
API](https://github.com/WICG/turtledove/blob/main/FLEDGE.md)---an in-browser API
that lets advertisers and ad tech companies show interest-group targeted ads
without relying on third-party cookies, while protecting users from cross-site
tracking.

In Protected Audience API, when a remarketing ad wins the auction, the render
URL of the ad will be sent to a [Fenced
Frame](https://developer.chrome.com/en/docs/privacy-sandbox/fenced-frame/) for
rendering. A fenced frame is a proposed HTML element for embedded content,
similar to an iframe. Unlike iframes, a fenced frame restricts communication
with its embedding context to allow the frame access to cross-site data without
sharing it with the embedding context. For more details, refer to the
[Fenced Frames use cases
explainer](https://github.com/WICG/fenced-frame/blob/master/explainer/use_cases.md).

Display \& Video 360 supports a list of
[macros](https://support.google.com/displayvideo/answer/2789508) for measurement
provider to use for impression and click tracking. Only a small subset of these
macros can be replaced as part of creative rendering, due to lack of contextual
and auction signals. For example, `${PUBLISHER_ID}` will break without changes
to measurement provider tags.

This guide is designed for [ad measurement partners that track
events](https://support.google.com/displayvideo/answer/6248876) for advertisers who
use Display \& Video 360.

## Enrollment

Starting in August 2023, measurement providers may need to follow the steps
below to register themselves to use Fenced Frame Reporting APIs in Protected
Audience API.

[Details on how and who will need to
enroll](https://developer.chrome.com/blog/announce-enrollment-privacy-sandbox/)

## Integration

### Measurement provider impression tags

Setup instructions:

- [Display \& Video 360](https://support.google.com/displayvideo/answer/6248876)
- [Campaign Manager 360](https://support.google.com/campaignmanager/answer/6136062)

| Script tags | **Example** ``` <script src='https://tracking.com/a.js'>xxx</script> ``` **Responsibility:** Measurement providers to update the script tags to use `reportEvent` API for impression tracking (see guidance below). |
| Img tags | **Example** ``` <img src='https://tracking.com/'> ``` **Responsibility:** Display \& Video 360 to update img src tags to use `reportEvent` API for impression tracking. |
|---|---|

#### reportEvent API

The API was [proposed](https://github.com/WICG/turtledove/issues/477) to be used for
post-rendering tracking only. The API contains two parts: `registerAdMacro` and
`reportEvent`.

- Display \& Video 360 owns the `registerAdMacro` function in `reportWin`. The function will register macro key-value pairs in the browser before the rendering call.
- Depending on the tag type, Display \& Video 360 or measurement providers own the changes to 3PAT tags to use `reportEvent` API.

`reportEvent` takes only 1 input 'destinationURL', which points
to measurement provider servers. It can contain any macros listed in
[Display \& Video 360 Help
Center](https://support.google.com/displayvideo/answer/2789508). For example:

    window.fence.reportEvent({
      'destinationURL': 'https://adtech.example/impression?cid=555&pub_id=${PUBLISHER_ID}&site=${SOURCE_URL_ENC}&t=123'
    });

When Chrome fires the URL ping in the function, it will look up registered
macros and replace them with the values before sending a HTTP GET request to
`https://adtech.example`.

#### Steps to update script tags

There will be no change to existing creative tags. Display \& Video 360 still
renders measurement provider tags without modification as part of the creative
payload. When measurement providers receive impression pings from the Protected
Audience API context, they need to follow the steps below for impression
tracking:

1. Prepare a measurement provider impression URL to accept the impression pings.
   For example:

       https://adtech.example/impression?cid=555&pub_id=${PUBLISHER_ID}&site=${SOURCE_URL_ENC}&t=123

2. Add `reportEvent` JS when responding to a script from Protected
   Audience API. For example:

       window.fence.reportEvent({
         'destinationURL': 'https://adtech.example/impression?cid=555&pub_id=${PUBLISHER_ID}&site=${SOURCE_URL_ENC}&t=123'
       });

3. Log impressions when receiving pings from the impression URL configured in
   step 1.

### Measurement provider click tags

Existing measurement provider click tag will continue to work for Protected Audience impressions. Display \&
Video 360 will use the Fenced Frames Ads Reporting API's
`reserved.top_navigation` beacon to register clicks, and will chain all
measurement provider click trackers as redirects. For more details, refer to
[Chrome's documentation for Fenced Frame Ads Reporting
API](https://github.com/WICG/turtledove/blob/main/Fenced_Frames_Ads_Reporting.md#support-for-attribution-reporting).