Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Update FF ads reporting API example #7906

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kevinkiklee
Copy link
Member

@kevinkiklee kevinkiklee commented Dec 4, 2023

This PR fixes the example to use the registerAdBeacon() call in a reporting worklet. The previous example used generateBid() where registerAdBeacon() 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

@chrome-devrel-infra
Copy link

chrome-devrel-infra bot commented Dec 4, 2023

function generateBid(interestGroup) {
const { campaignId } = interestGroup.ads.metadata;
// Protected Audience API reporting worklet
function reportResult(auctionConfig, browserSignals, directFromSellerSignals) {

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

Suggested change
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;

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

Suggested change
const { topLevelSeller } = browserSignals;

registerAdBeacon({
click: `https://your-server.example/report/click?campaignId=${campaignId}`
})
click: `https://your-server.example/report/click?topLevelSeller=${topLevelSeller}`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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;

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

Suggested change
return signalsForWinner;

@paulirish
Copy link
Member

paulirish commented Dec 20, 2023

hi kevin.
the source of truth for this site moved. you'll have to make your changes here go/tiloc

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants