Skip to content

analytics: per-bidder EID delivery and troubleshooting fields in auction_processed - #351

Draft
MO-Thibault wants to merge 1 commit into
Optable:masterfrom
MO-Thibault:mo/analytics-capture-fields
Draft

MO-Thibault wants to merge 1 commit into
Optable:masterfrom
MO-Thibault:mo/analytics-capture-fields

Conversation

@MO-Thibault

Copy link
Copy Markdown
Contributor

Summary

Adds the fields we kept missing during enrichment and uplift investigations to the V1 analytics add-on (lib/addons/prototypes/analytics.js), which feeds bid_analytics. Each one maps to a case that needed a browser harness or a partner conversation because the table could not answer it.

Per-bidder EID delivery, with no payload growth in the normal case. Today each bidder request's optableSources is computed and then collapsed into one auction-level union, so we cannot tell whether a given bidder received our IDs (ddm: whether msft got any after the appnexus rename). Each bidder request now carries om, a bitmask over the auction-level optableSources (bit i = optableSources[i]). It is omitted when the bidder received every source, which is the common case, so most payloads do not change. Absent means all sources; 0 means none.

New fields

Field Level Size Meaning
bidderRequests[].om bidder 0 bytes usually, ~7 when present Sources this bidder received, as a bitmask over optableSources
bidderRequests[].bids[].src bid only on s2s bids "s2s" for Prebid Server responses
unmatchedBids auction only when > 0 Received bids that matched no bidder request
slotSeq auction ~10 bytes Earlier auctions of this ad unit on this page view (0 = first, >0 = refresh or re-auction)
t0 auction ~10 bytes ms from page start to auction start
consent auction ~12 bytes Bitmask: 1 GDPR applies, 2 GPC, 4 US privacy opt-out, 8 GPP present, 16 TCF blocked storage
cacheAge auction ~15 bytes Seconds since the targeting cache was written; -1 when none
idsMs auction only when written this page ms from page start to our IDs landing (compare with t0)
page first auction of a page only ~60 bytes once { rtdOptable, rtdDelay, udDelay }

Documented in lib/addons/prototypes/README.md.

Prebid Server responses

On ddm, prebidServer requests show about 6.7M per day with 0 priced bids recorded. The likely cause is that s2s bid responses carry a requestId that matches no client bidId, so trackAuctionEnd drops them. Received bids that do not match now fall back to the same bidder code and ad unit (first bid still waiting for a response), keep src: "s2s", and anything still unmatched is counted in unmatchedBids. Not yet verified on a live Prebid Server page; unmatchedBids will tell us whether the fallback catches them.

Core change

LocalStorage.setTargeting now also writes <cacheKey>:ts with the write time, and clearTargeting removes it. The cache value itself is unchanged, so wrappers that parse OPTABLE_RESOLVED are unaffected. Control-group clearing that removes OPTABLE_RESOLVED directly leaves the :ts key behind, which is harmless: analytics reports an age only when the cache itself is present.

Not in this PR

  • The bid_analytics ETL still needs columns for these fields (separate change in optable-solutions). Until then they are only in the raw payload.
  • The V2 add-on (lib/addons/prebid/analytics.ts) is unchanged.
  • Bundles need a web-sdk bump to pick this up.

Test plan

  • New lib/addons/prototypes/analytics.test.js (14 tests): om omitted and masked, slotSeq counting, t0, each consent bit, the three cache states and custom key, page config on the first auction only, s2s fallback match, unmatched count, client bids unchanged.
  • lib/core/storage.test.js: :ts written on setTargeting, removed on clearTargeting.
  • Full suite: 30 suites, 500 tests pass. pnpm build-lib passes. pnpm format leaves no diff.
  • Load a bundle built from this branch on a test page and check one auction_processed payload.
  • On a Prebid Server tenant (ddm), confirm s2s bids now carry CPMs and check unmatchedBids.

🤖 Generated with Claude Code

…ion_processed

Per-bidder delivery as a bitmask over the auction's optableSources, omitted
when a bidder received every source. Adds slotSeq, t0, consent flags, cache
age and idsMs, first-auction page config (RTD registration and both
auctionDelay values), and Prebid Server bid matching with an unmatched count.
Storage writes a <cacheKey>:ts sibling so cache age can be measured.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@jplaroche

Copy link
Copy Markdown
Contributor

Should we add this to V2 (prebid/analytics.ts) too ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants