Demo: Attribution Reporting API
Demo version: v-2023-05-02
Ask questions / Share feedback 👋
Is there a feature you'd like to see added to this demo? Do you have any questions, requests, or issues running the demo?
We want to hear from you. Open an issue on our dev support repo and select the type Attribution Reporting (or ask your question on the developer mailing list).
We want to hear from you. Open an issue on our dev support repo and select the type Attribution Reporting (or ask your question on the developer mailing list).
See the code
Code for this demo. You can reuse and customize it.Set up your browser
⚠️ Make sure to follow these instructions.
Browser requirements
- Don't use Incognito or Guest mode, because the API is disabled on these profiles.
- Don't block third-party cookies.
- Deactivate ad-blocking extensions on the pages where you need to test the API (or create a fresh user profile without extensions). Ad-blocking browser extensions may block some of the API's functionality if script names contain the term "ad".
Setup (may require browser restart)
- Ensure the Privacy Sandbox APIs are enabled at chrome://settings/privacySandbox.
- Enable the flag chrome://flags/#privacy-sandbox-ads-apis (will require restart).
Run the demo
In this demo an advertiser uses an adtech provider to run their ads on a publisher site. Follow the flow below to see how the API generates event-level and aggregatable reports:
- First visit the publisher site and view and/or click an ad on that site.
- Because this ad is configured with special attribution parameters, a source event is registered. You'll see that either anchor elements or JavaScript calls can be used to generate a source event.
- Second, either follow the link for a clickable ad or visit the advertiser site directly (direct visits will *not* trigger a conversion)
- Third, interact with the product on the advertiser site by visiting the product page, adding the product to your cart, or making a purchase...
- While interacting with the product, the adtech endpoint will be informed. It decides that your actions are conversions, and hence will trigger attributions, with variable trigger data values, for your engagements on the advertiser's site.
- After attributions have been triggered, attribution reports are generated and stored in local storage in your browser (on your device).
- Finally, open chrome://attribution-internals to inspect the reports that have been generated.
- The reports are configured to be sent to the adtech provider setup in Step 1
Next Steps
Now that you've learned how event-level reports and aggregatable reports are generated, learn how to collect and process aggregatable reports with the aggregation service.