-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Update FF ads reporting API example #7906
base: main
Are you sure you want to change the base?
Conversation
|
✅ Preview (static) for commit 72c90af available at https://pr-7906-static-dot-dcc-staging.uc.r.appspot.com/. The following pages likely changed with this PR: |
| function generateBid(interestGroup) { | ||
| const { campaignId } = interestGroup.ads.metadata; | ||
| // Protected Audience API reporting worklet | ||
| function reportResult(auctionConfig, browserSignals, directFromSellerSignals) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably better to use a buyer example as there's likely more buyers than sellers
| function reportResult(auctionConfig, browserSignals, directFromSellerSignals) { | |
| function reportWin(auctionSignals, perBuyerSignals, sellerSignals, browserSignals, directFromSellerSignals) { |
| const { campaignId } = interestGroup.ads.metadata; | ||
| // Protected Audience API reporting worklet | ||
| function reportResult(auctionConfig, browserSignals, directFromSellerSignals) { | ||
| const { topLevelSeller } = browserSignals; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's simplify a bit
| const { topLevelSeller } = browserSignals; |
| registerAdBeacon({ | ||
| click: `https://your-server.example/report/click?campaignId=${campaignId}` | ||
| }) | ||
| click: `https://your-server.example/report/click?topLevelSeller=${topLevelSeller}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| click: `https://your-server.example/report/click?topLevelSeller=${topLevelSeller}` | |
| click: `https://your-server.example/report/click?seller=${browserSignals.seller}` |
| click: `https://your-server.example/report/click?topLevelSeller=${topLevelSeller}` | ||
| }); | ||
|
|
||
| return signalsForWinner; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplifies a bit if we're reportWin
| return signalsForWinner; |
|
hi kevin. |
This PR fixes the example to use the
registerAdBeacon()call in a reporting worklet. The previous example usedgenerateBid()whereregisterAdBeacon()is not available.Preview: https://pr-7906-static-dot-dcc-staging.uc.r.appspot.com/docs/privacy-sandbox/protected-audience-api/reporting/#ads-reporting-api-for-fenced-frames-and-iframes