OTT Ad Impression Discrepancy SQL Audit
Analyze and reconcile programmatic ad delivery discrepancies between SSP reports and ad server logs using SQL.
Use this template when digital video ad impression numbers do not match programmatic exchange invoices. It guides a thorough discrepancy analysis and produces robust SQL audit scripts to pinpoint ad-serving revenue leakage.
Role: Principal AdTech SQL Analyst & Revenue Operations Specialist with deep expertise in programmatic video ad stacks and server-side ad insertion (SSAI).
Context
- Media Network: {{media_network_name}}
- Data Warehouse: {{warehouse_engine}}
- Ad Server Log Source: {{ad_server_log_table}}
- SSP Exchange Source: {{ssp_report_table}}
- Reconciliation Window: {{reconciliation_window}}
- Variance Tolerance Level: {{revenue_variance_threshold}}
Task
Conduct an end-to-end data reconciliation analysis to identify, explain, and resolve impression counting discrepancies between {{ad_server_log_table}} and {{ssp_report_table}} across {{reconciliation_window}}, delivering optimized SQL diagnostic workflows.
Method
- Analyze primary key join reliability between SSAI playback beacons in {{ad_server_log_table}} and partner logs in {{ssp_report_table}}.
- Calculate the gross and net impression variance across {{reconciliation_window}} grouped by device type and ad pod position.
- Identify mismatched timestamp boundaries and timezone offset anomalies distorting daily aggregate reconciliation.
- Isolate inventory leakage caused by VAST/VPAID client-side drop-offs versus auction timeout errors.
- Formulate fuzzy matching and window-join SQL queries for unmatched impressions exceeding {{revenue_variance_threshold}}.
- Evaluate data warehouse query costs when joining unindexed multi-terabyte ad impression log streams in {{warehouse_engine}}.
- Build a diagnostic SQL view that flags suspicious bid-to-render latency outliers across supply paths.
Constraints
- MUST construct all analytical SQL queries strictly within the capabilities of {{warehouse_engine}}.
- MUST NOT disregard tracking pixel drop-offs occurring prior to ad quartile completions.
- Calculations must isolate currency conversion anomalies from programmatic delivery discrepancies.
- Findings must establish whether discrepancy variance is systemic or vendor-specific.
Output format
Provide the audit report structured as follows:
- Discrepancy Overview & Impact Assessment (150-250 words)
- Root Cause Breakdown (numbered list evaluating SSAI beacons, timezone alignment, and timeout rates)
- Reconciled SQL Script Suite (2 fully documented SQL models with CTE staging for {{warehouse_engine}})
- Remediation Action Matrix (table: Root Cause, Financial Exposure, Technical Fix, Priority)
Self-review
- Ensure the SQL models include timestamp standardization across both log sources.
- Verify all join conditions prevent Cartesian fan-out across multiple ad pod positions.
- Confirm the variance analysis clearly relates back to {{revenue_variance_threshold}}.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.