Skip to content

fix(prebid-analytics): send optableTargetingDone as '1'/'0' string, not a count#309

Merged
jrosendahl-opt merged 3 commits into
masterfrom
fix/prebid-analytics-optable-targeting-done-type
Jul 22, 2026
Merged

fix(prebid-analytics): send optableTargetingDone as '1'/'0' string, not a count#309
jrosendahl-opt merged 3 commits into
masterfrom
fix/prebid-analytics-optable-targeting-done-type

Conversation

@jrosendahl-opt

Copy link
Copy Markdown
Contributor

Summary

  • optableTargetingDone was set to oMatchersSet.size || oSourcesSet.size — a JS number (0, 1, 2, …)
  • The analytics processor schema declares this field as STRING and classifies status via IN ('1', 'true') / IN ('0', 'false')
  • Spark's JSON reader coerces a JSON number to its string form, so 2 (uid2 + id5 active) arrived as "2" — matching neither branch → status = 'unknown' for every enriched auction with 2+ matchers
  • Single-matcher case worked by coincidence: "1" ∈ ('1', 'true')

Fix

Send the literal string '1' (enriched) or '0' (not enriched). The full matcher/source identity is already carried by optableMatchers and optableSources arrays, which the processor stores directly in fact_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

  • Verify optableTargetingDone in witness payload is '1' when Optable EIDs are present (any number of matchers)
  • Verify optableTargetingDone is '0' when no Optable EIDs are present
  • Confirm optableMatchers array still carries the full list of active matchers

🤖 Generated with Claude Code

jrosendahl-opt and others added 3 commits July 22, 2026 14:05
…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>
@jrosendahl-opt
jrosendahl-opt merged commit 34b96d0 into master Jul 22, 2026
7 checks passed
@jrosendahl-opt
jrosendahl-opt deleted the fix/prebid-analytics-optable-targeting-done-type branch July 22, 2026 20:31
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