Archived: [Obsolete] Migration guide (Chrome 92): Conversion Measurement API to Attribution Reporting API - Chrome Developers

This is a simplified archive of the page at https://developer.chrome.com/docs/privacy-sandbox/attribution-reporting-migration/

Use this page embed on your own site:

Build the next generation of web experiences.

ReadArchived

The Conversion Measurement API is changing in Chrome 92.

Published on Updated on

Translated to: Español, Português, 한국어, 中文, Pусский, 日本語, Français, Deutsch

If you have questions or need support during your migration, join the mailing list and ask your question.

What's changing?

Following the API proposal's changes in the first months of 2021, the API implementation in Chrome is evolving. Here's what changing:

  • The API name, and the feature policy name.
  • The HTML attribute names and .well-known URLs.
  • The format of the reports. Reports are now sent as JSON in the request body.
  • The content of the reports: credit has been removed, along with reports that would have had 0 credit.

What remains unchanged in Chrome 92 is the set of supported features: event-level reports, for clicks only. Expect updates on this. After this change, other updates and features will be released in future Chrome versions.

To receive updates on the origin trial for this API and upcoming features, subscribe to the mailing list.

When do these changes take effect?

These changes take effect starting from Chrome 92, stable on July 20th 2021. Chrome 92 beta was released on June 3rd 2021.

What should you do?

There are more changes to the API coming in future versions. They will use the new naming adopted in Chrome 92.

If you're running an origin trial or have implemented a demo for this API, you have two options:

  • Option 1 (recommended): migrate your code now or in the following weeks, ideally before mid-July 2021. This way, your codebase will be ready for future changes and will keep working for newer Chrome clients.
  • Option 2: Wait for more updates and features to be released in future Chrome versions, and make all necessary code changes at once.

Migrate

Example migration

You can see a migration example for a small demo app in this pull request (draft).

Update your feature policy code

Legacy codeNew code
allow='conversion-measurement'allow='attribution-reporting'

Update your feature detection code

Legacy codeNew code
document.featurePolicy.features()
.includes('conversion-measurement')
document.featurePolicy.features()
.includes('attribution-reporting')

Update the HTML attributes

Legacy codeNew code
conversiondestinationattributiondestination
impressiondataattributionsourceeventid
impressionexpiryattributionexpiry
reportingoriginattributionreportto

Update window.open() arguments

An attribution source can be registered for navigations initiated by window.open(). Update these calls if you're using window.open() to register attribution sources.

Your new code should look as follows (this renaming follows the HTML attributes renaming):

window.open(
'https://dest.example',
'_blank',
'attributionsourceeventid=1234,attributiondestination=https://dest.example,attributionreportto=https://reporter.example,attributionexpiry=604800000'
);

Update your registration call URL and parameter

Legacy codeNew code
.well-known/register-conversion?conversion-data={DATA}.well-known/attribution-reporting/trigger-attribution?trigger-data={DATA}

Update your reporting endpoint code

Legacy codeNew code
Requests to expect from the browser.well-known/register-conversion?impression-data=&conversion-data={DATA}&attribution-credit=100.well-known/attribution-reporting/trigger-attribution
Incoming reportsSent as URL parameters.Sent as JSON in the request body.

The report data is included in the request body as a JSON object with the following keys:
source_event_id: formerly impression-data, the 64-bit event id set on the attribution source.
trigger_data: formerly conversion-data, the 3-bit data set in the attribution trigger redirect.

⚠️ credit has been removed.

Attribution Reporting: all resources

See Attribution Reporting.