Sub topic 3
Checking the data before you trust it
Every later step in a campaign review depends on the numbers being right. This chapter covers how to test whether campaign data is complete, internally consistent, and understood before you calculate CTR, CPA, or ROAS from it. It assumes you can read an analytics dashboard and a spreadsheet, and you know what impressions, clicks, and conversions are. The Python is optional. It uses only the standard library.
Why check first
A wrong number does not look wrong. A dashboard that is missing two days of data reports a lower spend and a lower conversion count, and the ratios between them can still look plausible. If you build a hypothesis on that, you may fix a problem that does not exist.
Data problems fall into two groups:
- Quality problems: the numbers are missing, duplicated, mis-timed, or polluted by traffic that is not real customers.
- Attribution problems: the numbers are accurate counts, but the rules that decide which campaign gets credit for a conversion are not what you assumed.
You check quality first, then attribution. If quality is bad, no attribution rule can rescue the result.
Quality checks
Run these checks in order, before you open any chart.
Completeness
- Date range. Confirm that the first and last day in the export match the campaign dates. Look for gaps in the middle, such as a day when the tracking tag failed.
- Coverage across platforms. If the campaign ran on three channels, confirm that all three appear in the export. A channel whose connector broke silently simply vanishes.
- Missing values. An empty cell and a zero are different things. A blank conversion count means "not recorded". A zero means "recorded, and none happened". Treat them separately.
- Row counts. Compare the number of rows to what you expect, for example one row per day per campaign.
Consistency
Some relationships between metrics must hold, and a violation points to a bug or a definition mismatch:
- Clicks should not exceed impressions.
- Spend should not be zero on a day with delivered impressions, unless the campaign was free (for example, organic or a credit).
- Conversions should usually not exceed clicks. There are legitimate exceptions: view-through conversions, repeat conversions from one click, and email conversions that came through a different channel. Flag the row, then find out which case applies.
- Totals across breakdowns should match the grand total. If the sum of your regions is lower than the campaign total, some rows have an "unknown" or "other" region that your pivot dropped.
Duplicates and test data
- Duplicate rows appear when an export is appended twice or when two connectors write the same data. They inflate every count but leave ratios mostly unchanged, which makes them easy to miss.
- Test conversions come from your team checking that the checkout works. Filter them by internal IP addresses, test email domains, or a test flag.
- Invalid traffic is clicks from bots or accidental taps. It lowers CVR and raises CPA without telling you anything about your offer. Look for clicks with near-zero time on site, or a sudden spike from one placement.
Timing
- Time zones. The ad platform may report in the account's time zone and your analytics tool in UTC. Daily totals then disagree even when both are correct.
- Currency. Confirm that spend and revenue use the same currency. Mixed currencies make ROAS meaningless.
- Conversion lag. Many people convert days after they click. If you review a campaign two days after it ends, the most recent days are incomplete. Their CVR looks artificially low. Compare only cohorts that have had the same time to mature.
A small script for the mechanical checks
The following script runs the row-level checks above on a daily export. It also compares one count between two sources. It runs as written.
from datetime import date, timedelta
rows = [
{"day": date(2026, 11, 1), "spend": 140.0, "impressions": 28000, "clicks": 420, "conversions": 17},
{"day": date(2026, 11, 2), "spend": 150.0, "impressions": 30000, "clicks": 450, "conversions": 19},
{"day": date(2026, 11, 2), "spend": 150.0, "impressions": 30000, "clicks": 450, "conversions": 19},
{"day": date(2026, 11, 4), "spend": 145.0, "impressions": 29000, "clicks": 400, "conversions": 22},
{"day": date(2026, 11, 5), "spend": 0.0, "impressions": 100, "clicks": 3, "conversions": 5},
]
def check_rows(rows, start, end):
problems = []
seen = set()
for r in rows:
if r["day"] in seen:
problems.append(f"duplicate row for {r['day']}")
seen.add(r["day"])
if r["clicks"] > r["impressions"]:
problems.append(f"{r['day']}: more clicks than impressions")
if r["conversions"] > r["clicks"]:
problems.append(f"{r['day']}: more conversions than clicks")
if r["spend"] == 0 and r["impressions"] > 0:
problems.append(f"{r['day']}: impressions with zero spend")
expected = {start + timedelta(days=i) for i in range((end - start).days + 1)}
for missing in sorted(expected - seen):
problems.append(f"missing day {missing}")
return problems
def reconcile(platform, other, tolerance=0.15):
gap = abs(platform - other) / platform
return gap, gap > tolerance
for problem in check_rows(rows, date(2026, 11, 1), date(2026, 11, 5)):
print(problem)
gap, flagged = reconcile(platform=120, other=87)
print(f"{gap:.1%}", flagged)
# duplicate row for 2026-11-02
# 2026-11-05: more conversions than clicks
# 2026-11-05: impressions with zero spend
# missing day 2026-11-03
# 27.5% TrueThe script cannot decide what to do about a problem. It only tells you where to look. A flagged row may be a bug, or it may be a legitimate case such as a view-through conversion.
Reconciling sources
A campaign usually has at least two records of the same conversion: the ad platform's report and your own analytics, store, or CRM. They will not match exactly. The question is whether the gap is small and explainable.
| Source | Typically counts | Typical bias |
|---|---|---|
| Ad platform | Conversions it can link to an ad view or click | Higher, because it counts view-throughs and claims credit generously |
| Web analytics | Sessions and events with a tracking tag | Lower when consent banners, ad blockers, or tag failures drop events |
| Store or CRM | Actual orders or leads | Closest to the truth, but may lack campaign labels |
Treat the store or CRM as the anchor for totals when you have it, because a real order exists whether or not a tag fired. Use the ad platform for the breakdown by campaign, ad, and audience. Then compare the ratio between sources over time. A stable 20% gap is a known offset you can account for. A gap that grows from 10% to 35% mid-campaign suggests that something broke, such as a tag change or a consent update.
Set a tolerance before you look. A common starting point is 10% to 15% for conversion counts and 2% to 5% for spend, since spend is billed and should reconcile closely with the invoice. Decide on the numbers by looking at past campaigns, not by looking at this one's result.
Attribution: whose conversion is it?
Attribution is the set of rules that assigns credit for a conversion to a touchpoint. The same purchase can be counted as a win by several campaigns at once, and each report can be correct under its own rules. Before you compare results, find out which of these settings apply.
| Setting | What it decides | How it changes the numbers |
|---|---|---|
| Attribution model | Which touch gets credit: last click, first click, linear, data-driven | Last click favors bottom-funnel channels such as search. First click favors discovery channels. |
| Lookback window | How long after a click or view a conversion still counts | A 30-day window credits more conversions than a 1-day window. |
| View-through | Whether a conversion counts when the user saw an ad but never clicked | Raises conversions for display and video. It can include people who would have bought anyway. |
| Cross-device | Whether activity on a phone and a laptop is linked to one person | Without it, one buyer can look like two unrelated users. |
| Deduplication | Whether a conversion claimed by two channels is counted once | Without it, summed platform conversions exceed real orders. |
Two practical consequences follow.
First, never add up conversions from several ad platforms and treat the sum as total conversions. Each platform claims credit under its own rules, so the sum usually exceeds your real order count. Compare the sum to the CRM total. The ratio shows how much credit is being double-claimed.
Second, make attribution identical across the things you compare. If you compare a search campaign on a 1-day click window with a social campaign on a 7-day click-plus-view window, the social campaign has an unearned advantage. Align the windows, or state clearly that you could not.
Campaign labels
Attribution in your own analytics depends on UTM parameters, the tags added to ad URLs such as utm_source and utm_campaign. Inconsistent labels split one campaign into several rows. Facebook, facebook, and fb are three different sources to a report. Check the list of distinct values for each field. Merge variants before you total anything. Check that no real traffic landed in (not set) or direct. A large share there usually means that links were published without tags.
Gotchas
- Recent days are immature. Exclude the last few days from CVR and CPA comparisons, or compare each cohort only at the same age, such as conversions within 3 days of the click.
- Consent changes move your baseline. If a consent banner went live mid-campaign, tracked conversions can drop with no change in real behavior. Compare against the CRM to separate the two.
- Platform changes revise history. Some platforms restate conversions after the fact as modeled or delayed data arrives. Save a dated copy of each export so that you can see what changed.
- Zero is a valid result. A channel with no conversions might be failing, or its tag might be broken. Check the tag on a test visit before you conclude the audience does not convert.
- Sampling. Some analytics tools estimate large queries from a sample. A sampled report can differ from the full data, so narrow the date range or use the raw export.
What to do when checks fail
You have three options for each problem, and you should choose deliberately:
- Fix it when the cause is clear and you can recover the data, such as removing a duplicate export.
- Adjust for it when the bias is known and stable, such as a constant 20% gap between platform and CRM conversions.
- Document it and lower your confidence when you cannot repair it. A result built on partly broken data can still guide a small next test. It should not justify moving a large budget.
Write down the checks you ran and their outcomes. This record becomes part of the learning log at the end of the review.
Exercise
A campaign's ad platform reports 240 conversions. Your store system shows 150 orders with a campaign label for the same dates, and the ad platform uses a 28-day click-plus-view window. A colleague says the campaign is underperforming because only 150 orders were real. What do you check before accepting that conclusion, and what would explain the gap without any tracking fault?
Show answer
Check that both sources cover the same dates and time zone, that orders are counted once each, and that test orders are excluded. Then check which attribution rules produce the 240 figure. A 28-day window with view-through credit, together with credit also claimed by other channels, can explain a 240 versus 150 gap. The platform number is not wrong, it is counted under looser rules. Compare the two sources at the same window, for example 7-day click only, and judge performance against the CRM total. Do not call the campaign underperforming until the gap is explained.
Exercise
You run the daily check script on an export and it reports "missing day 2026-11-03" and "more conversions than clicks" on one day. Which of these two findings can be legitimate, and how would you decide?
Show answer
A day with more conversions than clicks can be legitimate. View-through conversions, several conversions from one click, or conversions credited from another channel can cause it. Decide by looking at the attribution settings and the raw conversion events for that day. A missing day is not legitimate in a continuous campaign. It means the data is incomplete, so find out whether the campaign was paused or the export or tag failed, and recover the data before you calculate totals.