fix(prebid-analytics): send optableTargetingDone as '1'/'0' string, not a count#309
Merged
jrosendahl-opt merged 3 commits intoJul 22, 2026
Merged
Conversation
…t a count
The field was set to `oMatchersSet.size || oSourcesSet.size`, which
evaluates to the matcher count (0, 1, 2, …). The analytics processor
schema declares this field as STRING and routes it through:
CASE WHEN … IN ('1', 'true') THEN 'enriched'
WHEN … IN ('0', 'false') THEN 'notenriched'
Spark's JSON reader coerces a JSON number to its string representation,
so a count of 2 (e.g. uid2 + id5) arrives as "2" — matching neither
branch and producing status='unknown' for every enriched auction with
2+ active matchers.
The single-matcher case worked by coincidence ("1" ∈ ('1','true')).
Fix: send the literal string '1' or '0'. The count/identity of active
matchers is already carried by the optableMatchers array, which the
processor stores in fact_impression_opportunity.matchers directly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Regression coverage for the fix that changed optableTargetingDone from a raw count (number) to '1'/'0' strings. Adds four cases: single matcher, two matchers (uid2+id5 — the silent regression where count=2 → "2" → status='unknown'), no EIDs, and sources-only targeting. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mosherBT
approved these changes
Jul 22, 2026
jrosendahl-opt
deleted the
fix/prebid-analytics-optable-targeting-done-type
branch
July 22, 2026 20:31
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.
Summary
optableTargetingDonewas set tooMatchersSet.size || oSourcesSet.size— a JS number (0, 1, 2, …)STRINGand classifies status viaIN ('1', 'true')/IN ('0', 'false')2(uid2 + id5 active) arrived as"2"— matching neither branch →status = 'unknown'for every enriched auction with 2+ matchers"1" ∈ ('1', 'true')Fix
Send the literal string
'1'(enriched) or'0'(not enriched). The full matcher/source identity is already carried byoptableMatchersandoptableSourcesarrays, which the processor stores directly infact_impression_opportunity.matchers.Impact
Any tenant running both uid2 and id5 (the typical Optable configuration) was having every enriched auction silently classified as
'unknown'instead of'enriched'in the Prebid analytics fact tables.Test plan
optableTargetingDonein witness payload is'1'when Optable EIDs are present (any number of matchers)optableTargetingDoneis'0'when no Optable EIDs are presentoptableMatchersarray still carries the full list of active matchers🤖 Generated with Claude Code