WICG / turtledove

TURTLEDOVE
https://wicg.github.io/turtledove/
Other
512 stars 216 forks source link

Guidance and clarification regarding CPC billing #1104

Open omriariav opened 3 months ago

omriariav commented 3 months ago

Hi all,

Background: A common model in native advertising is CPC. A native advertising platform charges the advertiser when a user clicks a sponsored content item (ad).

Ad tech platforms engage in different use cases that involve campaign stoppage (avoiding overcharging), billing accountability, bid optimization, bid tuning, campaign pacing, and other related issues (see this case from three years ago—https://github.com/WICG/turtledove/issues/175).

In PAAPI, these use cases will happen in the client upon generating the bid (buyer) and scoring the ad (seller).

To support CPC billing, we need to keep real-time reporting.

What we know: Until the aggregate reporting and fenced frames reporting APIs are enforced in 2026, the following event-level reportings are currently available:

According to the explainer, registerAdBeacon() and registerAdMacro() functions can report the click event within the fenced frame. However, fenced frame does not support native advertising yet, and both of those functions are missing information about the bid and ad cost. There is also ambiguity in the document regarding these functions availability in the current stage of event-level reporting.

Challenge: CPC billing is impossible.

There is a race condition between: reportWin and reportResult events with the CPC (these events are reporting the bid and adCost values) - fired upon win and render of the ad, and not when the user is clicking the ad. And: The SSP own click reporting event that lacks the CPC billing value as it just comes from the renderUrl within the iframe

Open questions:

We're seeking clarity on implementing 'CPC billing' effectively, especially considering the current challenges.

Thank you!

omriariav commented 3 months ago

@michaelkleber I found out those wordings here: Note window.fence here is a new namespace for APIs that are only available from within a fenced frame. In the interim period when FLEDGE supports rendering the winning ad in an iframe, window.fence will also be available in such an iframe.

Potentially, we can fire events (registerAdBeacon() and registerAdMacro()) now from the "regular" iframe, right? The only thing is that we need to ensure those events will hold ad cost and bid information.

Will appreciate further guidance. Thank you!

michaelkleber commented 3 months ago

If you are rendering the ad inside a fenced frame or an iframe where the src is the render URL that came out of the PA auction, then you can use the registerAdBeacon() and registerAdMacro() functions. (For native ad rendering in that situation, you would presumably use something like postMessage to push some how-to-render information into that frame to make the ad look like you want it to.)

If that doesn't meet your needs — which is to say, if your plan is to pull information out of that iframe, and instead render it somewhere up in the publisher page — then you won't have that reporting system available. In that case you can still reconstruct the association between auctions and their clicks, but it would be more involved:

  1. Inside the iframe whose src is the render URL, you can create a unique event ID, e.g. by calling crypto.randomUUID() or whatever mechanism you want.
  2. Associate that event ID with the auction using registerAdBeacon() and registerAdMacro() inside the iframe.
  3. Associate that event ID with the ad click by inserting it somehow into the ad click URL that you render, or however it is that you are used to learning about clicks.

With this technique you will end up getting two reports: one with the event ID and the information from the auction, and another with the same event ID and information about the click. Then you will need to do some kind of server-side log join to connect them to each other.

If I were picking between the two techniques, I would probably try the "render inside the iframe" approach. That one is more future-proof when looking ahead to the Fenced Frame era: of course we will need some different way to get the rendering info into the Fenced Frame, but the essential idea should stay the same. But depending on how your various systems work, the log-join approach might be easier to implement for now.