ampproject / ampproject/amphtml
[AMPHTML ads] Support Conversion Measurement API
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
## Motivation
The Chrome team started an effort which provides a new API surface to measure conversions in a privacy preserving manner. This API will potentially become a new web platform standard which allows for measuring and reporting click through conversions. With third-party cookies are either unavailable or undesirable in the near future, privacy preserving conversion measurement becomes important to publishers and advertisers.
I propose to add support for conversion measurement API in AMPHTML ads.
## Overview of Conversion Measurement API
Here is a quick overview of conversion measurement API. Refers to API [explainer](https://github.com/WICG/conversion-measurement-api/blob/master/README.md) for details.
Upon an ad click, the browser will register the attribution source (ad click) in local storage if the API is invoked. To invoke the API, there are two ways:
- Anchor tag navigations
An attribution source is an anchor tag with a set of special attributes.
Clicking on an anchor tag that specifies these attributes will create a new attribution source event that will be handled by browser.
- window.open() navigations
An attribution source can be registered for navigations initiated by a new window.open() overload.
At the time window.open() is invoked, if the associated window has a [transient activation](https://html.spec.whatwg.org/multipage/interaction.html#transient-activation), an attribution source event will be created.
The arguments to the API (impression data) will be provided by ad server during serving time.
When conversion happens, the browser will look up the associated attribution source in local storage and report back to ad server.
## Proposal
Since amp runtime doesn't decorate anchor tag, we focus on extending functionality of amp-ad-exit for invoking the API through window.open() override.
### Option 1: Behaviors
This option includes extending Behaviors object by adding a new behavior object browserAdConversion that carries the impression data received from ad server. The proposed design of the extension is shown below.
```
{
"targets": {
"landingPage": {
"finalUrl": "https://abc.com/click?id=xxx",
"behaviors": {
"browserAdConversion" : {
"ConversionDestination": "abc.com",
"ImpressionData": "EFnZ8GunL1xrwNTIHbXrvQ==",
"ImpressionExpiry": 1234556,
"ReportingOrigin": "google.com",
}
}
},
},
}
```
The browserAdConversion behavior will trigger the amp runtime to invoke window.open() with the parameters stored in the object.
### Option 2: TrackingUrls
This option includes extending trackingUrls object by adding a new object (currently only strings are allowed) browserAdConversion that carries newton impression data. The proposed design of the extension is shown below.
```
{
"targets": {
"landingPage": {
"finalUrl": "https://abc.com/click?id=xxx",
"trackingURLs": [
"browserAdConversion" : {
"ConversionDestination": "abc.com",
"ImpressionData": "EFnZ8GunL1xrwNTIHbXrvQ==",
"ImpressionExpiry": 1234556,
"ReportingOrigin": "google.com",
},
]
},
},
}
```
The amp runtime will search for browserAdConversion in trackingURLs section and invoke window.open() override.
## Additional context
API Explainer: https://github.com/WICG/conversion-measurement-api
Contributor guide
Assessment
This issue has not been assessed yet.