Analytics
A/B Testing, Part 3: Metrics, Contamination and When You Can't A/B Test
Part 3 of 3: Primary, Secondary and Guardrail metrics. Test contamination. Why peeking hurts, and when not to A/B test.
Covered so far
- Part 1: What is an A/B test?, Test execution process, Analysing the result: p-value and confidence interval
- Part 2: Covered essential metrics: Sample size, MDE, Power and Test duration
In this part
- Which primary, secondary and guardrail metrics to use for a product-page (PDP) test
- Test contamination: Sample ratio mismatch, Peeking, Novelty effects, Spillover and broken data
- How Peeking impacts results and inflates false wins, in a simulator
- When you can't A/B test, and what to use instead
Neelgiri Home's new product page won, the new page had 6.60% add-to-cart vs 6.00% in the old page, with a p value = 0.0035. The question is: Ship it?
Before answering the above question we need to answer 2 questions first:
- Did the win cost anything elsewhere, like a slower page or more returns?
- Can the data be trusted at all?
This part is about both the above questions, and about the situations where an A/B test isn't the right tool.
Metrics to use for A/B tests
Every A/B test needs metrics in three roles, which are agreed upon before launch.
- Primary metric: The one number that decides the test. It should be closely tied to the change (so it moves enough to detect) and to a business goal therefore choose exactly one. Picking 5 "primary" metrics and, even if the change does nothing, there's more chance that a 1-in-5 chance that at least one looks significant by luck.
- Secondary metrics: This helps to explain why the primary moved. These don't decide the test result.
- Guardrail metrics: Things (metrics) that must not get worse. A win on the primary with a broken guardrail isn't a win.
A well practice is to add Sanity Checks: numbers that tell you whether the test itself is valid, like whether the 50/50 split held.
Here's Neelgiri Home's set for the product-page test:
Figure 1: Primary, secondary, guardrail and sanity metrics for Neelgiri Home's product-page test.
Why add-to-cart metric, and not orders or revenue? The PDP page's job is to get the product into the cart. Checkout happens on other pages that the test didn't touch. Add-to-cart also has a 6% baseline, against 2% for orders, so it needs far fewer visitors (In Part 2: we explained that due to this we need 14 days of testing instead of 6 weeks). Orders and revenue per visitor still sit in the secondary row, so a page that wins on carts but loses on orders gets caught.
Why those guardrails? Bigger photos can slow the page, especially on mobile, so load time and bounce rate are watched. "Delivered by Thursday" is a promise; if more orders get cancelled or returned because it wasn't kept, the win is hollow.
Check out the metrics when the same thinking applied to other common tests:
| Test on | Primary | Secondary | Guardrail |
|---|---|---|---|
| Product page (PDP) | Add-to-cart rate per product-page visitor | • Orders and revenue per visitor • Gallery swipes | • Load time • Bounce rate • Cancellations • Returns |
| Cart and checkout | Checkout completion rate | • Time to complete • Payment-method mix • Coupon use | • Payment failures • Average order value • Support tickets |
| Search results | Share of searches followed by a product click | • Zero-result searches • Searches that end the visit | • Search speed • Revenue per visitor |
| Home page banner | Click-through to product pages | • Pages per visit • Orders per visitor | • Load time • Clicks on other home-page sections |
| Price or discount | Gross margin per visitor | • Conversion rate • Average order value | • Refunds • Complaints |
| Email subject line | Click rate | • Open rate • Orders per email sent | • Unsubscribes • Spam complaints |
When does an A/B test get contaminated?
An A/B test is contaminated when something other than the change makes the two groups differ, or when the data about them can't be trusted. A contaminated test can produce a confident, significant, wrong answer. These are the usual causes.
1. Sample ratio mismatch (SRM)
This is something we left out of Part 1: Neelgiri Home ran the test twice. The first run was planned as 50/50, but recorded this:
Figure 2: The first run's split. A 51.1% / 48.9% split from a 50/50 coin is far too uneven to be luck. (The y-axis starts at 26,500.)
A 51.1% vs 48.9% split looks harmless. But with 56,000 visitors, a fair coin should land within about ±0.4 points of 50%. A chi-square test (the standard check for counts like these) gives p ≈ 0.0000003. Something was eating Group B's visitors.
The most probable cause of the contamination: The variant's bigger photos made the page heavier, and the tracking script loaded after them. Visitors who left within a second or two were never recorded in Group B. Those quick leavers rarely add to cart, so losing them made B's add-to-cart rate look better than it really was. The next action item has to be for the team to fix the tracking and re-ran the test, and Part 1 reports the clean second run.
📌 Key idea: Check the split before you look at any result. If the SRM check gives p below 0.001, don't trust the result, however good it looks. Find the cause first.
2. Peeking
Peeking means checking results while the test runs and stopping as soon as p drops below 0.05. It sounds harmless. Every check is another roll of the dice, though, and you only need one lucky roll to "win."
Drag the slider to check the results more often, and watch the false-win rate climb.
Drag the slider to check more often
Out of 100 tests where the new page does nothing at all, you would wrongly declare a winner in about 5 → 22 of them.
False-win rate by number of checks (4,000 simulated no-difference tests):
Figure 3: Peeking simulator. 4,000 simulated tests where the new page does nothing, checked between 1 and 28 times over 14 days.
Deciding only at the end and will get the 5.1% false-win rate we signed up for, give or take simulation noise. Check once a day and stop at the first p below 0.05, and 21.8% is chance of false wins ie.declaring wrong winners. Checking twice a day increases that to: 28.0%.
The fix to the above issue is the end date we set in Part 2. Look at the dashboard if you like, for bugs and broken guardrails, but don't make the call until the planned end date. Teams that need to stop early use methods built for it, called Sequential tests, which raise the bar at each look.
3. Novelty and Change aversion
There are 2 concepts at play here:
- Regular visitors notice anything new, they would then click a new banner because it's new, and that excitement fades.
- Change aversion is the opposite: Regulars dislike the new layout at first, then get used to it.
Figure 4: A novelty effect in a separate Neelgiri Home test of a new home-page banner. The early lift came from returning visitors and faded.
In this test, the banner's lift among returning visitors (purple) started at +24% and settled at about +4%. First-time visitors (teal), for whom nothing is new, stayed around +4% all along. A one-week test would have badly overstated the lift.
4. Spillover between groups
The groups must stay separate, they mix when:
- The same person sees both versions, for example logged out on a phone and on a laptop
- The groups share something limited: If the new page sells out a cushion, control visitors see "out of stock" too
- People talk: A customer shares a discount code meant only for Group B
5. Broken data and Outside shocks
Bot traffic landing in one group, a variant that breaks on an old Android browser, two tests changing the same page at once, or someone tweaking the variant halfway through. Any of these makes the groups differ for reasons that have nothing to do with the idea you're testing.
⚠️ Pitfall: Don't change anything mid-test: not the variant, not the split, not the metric. If something must change, stop and restart, and treat the two runs as separate tests.
What slows A/B experimentation down
Even with clean tests, then teams can run into bottlenecks:
- Traffic: Low-traffic pages need months, so only the busiest pages get tested often.
- Engineering and QA time: Every variant has to be built and checked on every device.
- Queues: Tests on the same page can interfere, so they wait in line.
- Long-term effects: A two-week test can't see returns that arrive in week five, or whether customers come back next season.
- Too many metrics: Each metric has a small chance of looking like a winner just by luck. Check enough of them, say 20, and one is likely to look like a win even when the change did nothing. So decide on the primary metric, and treat a surprise in a secondary one as a reason to test again, not a win.
- Testing Culture: A test with no winner is useful too. It stopped us from shipping something that doesn't help.
When we can't run an A/B test
Figure 5: Four questions to ask before running an A/B test, and what to do when the answer is no.
- Can't randomise people. TV ads, billboards and a new store reach whole cities. The way is to use a Geo Test: compare test cities with a matched set of control cities. The Synthetic Control series and Synthetic DiD series cover how.
- Not enough traffic. A B2B site with 200 visitors a week can't detect a 10% lift in any reasonable time.
- The groups can't be kept apart. In a food-delivery app, a new feature that speeds up riders in Group B leaves fewer riders free for Group A. Splitting by city, or by time slot (a switchback test), keeps the groups apart.
- Fairness or Legal issue. Showing different prices to different people may break consumer rules or customer trust, and safety features shouldn't be held back from anyone.
- A one-time change. A new logo or brand name can't be shown to half of India.
Key Takeaways
- Use one primary metric, a few secondary metrics to explain the why, and guardrails that must not get worse. For Neelgiri Home's PDP test: add-to-cart rate; orders, revenue and engagement; load time, bounce rate, cancellations and returns.
- A test is contaminated when something other than the change makes the groups differ, or when the data can't be trusted.
- Check the split first. Neelgiri Home's 51.1% / 48.9% first run (p ≈ 0.0000003) came from a tracking bug that flattered the variant.
- Peeking daily and stopping at the first p below 0.05 turns a 5% false-win rate into about 22%. Set the end date and stick to it.
- When we can't randomise, can't reach the sample size, can't keep groups apart or can't fairly hold the change back, use geo tests, cluster or switchback designs, or launch and monitor instead.
✅ Series complete: that wraps up the A/B Testing series. New here? Start from Part 1: What A/B Testing Is, How It Works and When to Use It. To measure campaigns you can't A/B test, continue with the Synthetic Control series.
Quick Quiz: Test Yourself
🧠 Test yourself: 4 questions (click to open)
1. For a test of a new product-page layout, which is the best primary metric?
2. A test planned as 50/50 records 28,610 vs 27,390 visitors. What should you do?
3. Why is checking results daily and stopping at the first p below 0.05 a problem?
4. A brand wants to measure a new TV campaign. Why can't it run a normal A/B test?
In case of any queries or feedback, feel free to drop a comment or reach out using the Contact section.