Troubleshoot worklets and observe Protected Audience API events.
From Chrome Canary 98.0.4718.0, it's possible to debug the Protected Audience API and Protected Audience API worklets in Chrome DevTools.
Read the developer guide for the full life cycle of the Protected Audience API. Not a developer? Refer to the Protected Audience API overview.
Protected Audience API worklets
The first step is to set breakpoints via a new category in the Event Listener Breakpoints pane in the Sources panel.
![DevTools in Chrome Canary, highlighting the Event Listener Breakpoints pane in the Sources panel. The Bidder Bidding Phase Start is selected under ad auction worklet.](https://developers.google.cn/static/privacy-sandbox/assets/images/devtools-chrome-canary-57f5cd39d92c7.png?authuser=8)
When a breakpoint triggers, execution is paused before the first statement at the top-level of the worklet script. You can use regular breakpoints or step commands to get to the bidding/scoring/reporting function itself.
Live worklet scripts will also show up under the Threads panel.
![Screenshot of DevTools in Chrome Canary, highlighting the Threads pane in the Sources panel, showing the current worklet script that has been paused.](https://developers.google.cn/static/privacy-sandbox/assets/images/screenshot-devtools-chr-1d07626da18cc.png?authuser=8)
Since some worklets may run in parallel, multiple threads may end up in the "paused" state. You can use the thread list to switch between threads, and resume or inspect them more closely as appropriate.
Observe events
From the Application panel in Chrome DevTools, you can observe Protected Audience API interest group and auction events.
If you visit the Protected Audience API demo advertiser site
in a browser with the Protected Audience API enabled, DevTools will display information about the join
event.
![The DevTools Application panel displaying information about a Protected Audience API interest group join event.](https://developers.google.cn/static/privacy-sandbox/assets/images/the-devtools-application-2d2a069c04829.png?authuser=8)
Now, if you visit the
Protected Audience API demo publisher site
in a browser with the Protected Audience API enabled, DevTools displays information about the bid
and win
events.
![The DevTools Application panel in Chrome Canary, showing information about Protected Audience API auction bid and win events.](https://developers.google.cn/static/privacy-sandbox/assets/images/the-devtools-application-557aaba0f062a.png?authuser=8)
All Protected Audience API references
API reference guides are available:
- Developer guide for the Protected Audience API.
- Ad buyer guide to Protected Audience interest groups and bid generation.
- Ad seller guide to Protected Audience ad auctions.
- Guide to reporting auction results
- Best practices for Protected Audience ad auction latency
- Troubleshoot Protected Audience
The Protected Audience API explainer also provides detail about feature support and constraints.
What's next?
We want to engage in conversations with you to ensure we build an API that works for everyone.
Discuss the API
Like other Privacy Sandbox APIs, this API is documented and discussed publicly.
Experiment with the API
You can experiment and participate in conversation about the Protected Audience API.