Skip to content

GAM attribution for Trusted Server A/B traffic (page-delivery marker) #1027

Description

@aram356

Objective

Give Google Ad Manager a way to segment the Trusted Server A/B experiment. A small, cookie-sticky treatment cohort is routed through Trusted Server while control continues on the production path. We add a page-level GPT key-value marker on every request from a TS-delivered document so GAM reporting can compare treatment impressions/clicks against the unmarked production baseline — without changing auction eligibility, ad delivery, consent, or performance.

Provisional marker: ts=true (key name pending the preflight below). Production stays unmarked; the control cohort is derived by subtraction within one experiment scope.

Design

Mechanism: enqueue googletag.setConfig({ targeting: { <key>: 'true' } }) in the early GPT head bootstrap (before the ts.adInit guard), with a defensive fallback in the TSJS GPT bundle gated on a non-executable activation attribute. Kept distinct from the existing slot-level ts_initial key and excluded from slot-cleanup arrays.

Acceptance criteria

  • Every in-scope GPT PubAds request from a TS-rewritten treatment document carries the marker (initial, lazy, refreshed, publisher-owned, SPA-route).
  • Production/control pages remain unmodified and unmarked.
  • ts_initial=1 keeps its current slot-level lifecycle; the marker is not cleared by Prebid refresh or SPA cleanup.
  • No GAM targeting consumer changes ad eligibility/pricing/protection/routing because of the key.
  • No personal data, no new network request, no blocking work.
  • GAM can report treatment counts under the marker and derive control by subtraction within one scope; coverage validated against router allocation before results are interpreted.

Work / blockers

  • Key-name preflight (blocking, do first). Confirm the enforced GAM key-name length limit and provisioning surface (UI vs REST vs SOAP): SOAP/REST document a 10-char CustomTargetingKey.name limit; other Help Center material implies 20. Attempt to create trusted_server (14) in the target network; record the enforced key-name and value limits. Then finalize the marker contract — exactly one key, one value, no dual-write. If the limit permits, a more descriptive, less collision-prone name is preferred over the short, collision-prone ts. This is a product-contract decision, not an automatic fallback to ts.
  • Fold in design-review findings before writing the plan: label GAM results as descriptive delivery attribution (not causal); make the production partition executable (exact eligible units, identical A/B report filters, preflight zero-counts for every excluded path, 0 ≤ Report B ≤ Report A invariants); acknowledge monitoring cannot prove per-response completeness; specify rollback drain ordering; extend the collision audit to Prebid-generated slot targeting (pbjs.bidderSettings, adserverTargeting, setTargetingForGPTAsync); preflight Enhanced key-value reporting availability/billing; soften the nested-document claim (a publisher can clone the tag via srcdoc/document.write).
  • Rebase the spec branch on current main and re-anchor file/line references; main changed the GPT/Prebid refresh surface in Preserve Prebid ad units across GPT refreshes #912 (bf61fa189).
  • Write the implementation plan (docs/superpowers/plans/2026-07-15-gam-ts-cohort-attribution.md) — only after the key contract is finalized and the branch is rebased.
  • Implement per the spec's Component changes: early bootstrap marker + source-order tests; attribute-gated bundle fallback; publisher-page-only activation attribute in tsjs.rs/html_processor.rs; JSDOM bootstrap tests; slot-cleanup / operator-targeting / Prebid-collision characterization tests.
  • Browser/GAM validation before launch (initial/lazy/refresh marker presence, control absence, CSP execution, ts_initial isolation, short GAM report).
  • GAM configuration in the target network: create the reportable key + predefined value; run the cross-system collision audit as a hard launch gate.

Non-goals

The cookie A/B router (owned externally); proving a TS server-side bid won; billing-grade or causal analysis from GAM alone; marking IMA/video, direct-tag, server-side, or non-independently-rewritten nested inventory.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions