Get splitTestAssignment from SDK bundle, if provided#304
Open
jplaroche wants to merge 1 commit into
Open
Conversation
and doesn't override if splitTestAssignment is already set (in case it is set server-side)
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
and doesn't override if splitTestAssignment is already set (in case it is set server-side)
Why
Split-test assignment tagging (
ortb2Imp.ext.optable.splitTestAssignment) is currently copy-pasted as atrackAuctionEndmonkey-patch across at least 4 SDK bundles (ezoic, britannica, publift, aditude — the latter merged just this week, #612). Each bundle wrapsanalytics(_v2).trackAuctionEndidentically to inject the same field before analytics processes the auction. Centralizing this in the SDK removes the duplication and the drift risk of bundles copy-pasting it slightly differently.What Changed
addons/prebid/analytics.ts(v2) /addons/prototypes/analytics.js(v1): added optionalgetSplitTestAssignment?: () => string | undefinedconfig callback.trackAuctionEnd: when configured, tags every bid'sortb2Imp.ext.optable.splitTestAssignmentwith the callback's return value — skipped if the bid already has asplitTestAssignmentset (e.g. set server-side upstream), so this never clobbers an existing value.getSplitTestAssignmentis omitted.'none'→'test'relabeling) intentionally stay owned by the calling bundle, not baked into the SDK — the callback returns the final string to tag.How to Test
npx jest lib/addons/prebid/analytics.test.ts— 5 new cases undertrackAuctionEnd - split test assignment(no-op when unconfigured, tags all bids, does not override existing assignment, preserves otherext.optablefields). Full suite: 452/452 passing.Notes
trackAuctionEndmonkey-patch onto this config option.