A/B testing isn’t rocket science. But it’s merciless with people who cheat on statistical rules. After 10 years analyzing tracking data, here’s what I’ve learned about running tests that actually produce reliable results.
1. Calculate Your Sample Size BEFORE Starting
Never launch a test without knowing how many visitors you need. This is the most common mistake I see.
Why it matters: If your sample is too small, you won’t detect real differences. If you stop too early because you see “significance,” you’re likely seeing noise, not signal.
How to calculate it:
The formula is: n = 2 × [σ² × (Z₁₋α/₂ + Z₁₋β)²] / δ² (simplified version assuming the same variance in both groups; calculators use the exact two-proportion formula and give a slightly larger n. See the NIST e-Handbook.)
Where:
- σ² = p₀(1-p₀) where p₀ is your baseline conversion rate
- Z₁₋α/₂ = 1.96 for 95% confidence
- Z₁₋β = 0.84 for 80% power (or 1.28 for 90%)
- δ = minimum detectable effect (MDE)
Practical example:
- Baseline: 5% conversion rate
- MDE: you want to detect +1% (so 6%)
- Confidence: 95%, Power: 80%
You need roughly 7,500–8,200 visitors per group depending on the formula (Evan Miller’s calculator: about 8,150).
Tools to use:
Critical point: The lower your expected improvement, the larger your sample size needs to be. If you’re testing subtle changes, you’ll need massive traffic.
2. Test for at Least Two Full Business Cycles
Even if you hit statistical significance after 3 days, keep going.
Why at least two full business cycles (for most sites, two full weeks)?
- Business cycles: Users behave differently on weekdays vs weekends. You need to capture at least 2 complete weekly cycles to smooth out these patterns.
- Returning buyers: people who started their journey before the test add noise to both groups; a longer test dilutes them.
- Traffic source variations: Different traffic sources (organic, paid, email) arrive at different times and behave differently.
Don’t run much longer than needed
Cookie loss and outside events build up over time:
- Cookies get deleted
- User patterns shift
- External factors accumulate
- You introduce new variables
Exception for high-traffic sites: If you have massive traffic and hit your sample size in 2-3 days, you still shouldn’t stop immediately. Even with sufficient sample size, you need to validate that the pattern holds across different days and user segments.
Sources confirm this:
- Evan Miller: “Repeated significance testing always increases the rate of false positives” (How Not To Run an A/B Test)
- Kameleoon recommends no fewer than 2 business cycles (usually 2-4 weeks) (Kameleoon)
- The consensus across the industry is clear: patience pays off
3. Verify Your Sample Ratio Mismatch (SRM)
This is a critical check that most people skip.
What is SRM?
Sample Ratio Mismatch occurs when your actual split doesn’t match your intended split. For example:
- You configure 50/50
- You observe: Group A = 5,000 visitors, Group B = 2,100 visitors
- This is a major SRM
Why it matters:
Microsoft Research found that approximately 6% of A/B tests have SRM issues. Even a small imbalance can:
- Distort conversion rates
- Make you detect false uplifts
- Mask real changes
- Completely reverse test outcomes
How to detect SRM:
Use a Chi-squared (χ²) goodness-of-fit test:
χ² = Σ [(Observed – Expected)² / Expected]
Threshold: use a strict cut-off (Microsoft uses p < 0.0005; many tools use p < 0.01). Source: Microsoft Research: Diagnosing Sample Ratio Mismatch.
Example calculation:
- Expected: 50/50 split with 10,000 total visitors = 5,000 each
- Observed: Group A = 5,200, Group B = 4,800
- χ² = [(5200-5000)²/5000] + [(4800-5000)²/5000] = 16
- With 1 degree of freedom, p < 0.01 means χ² > 6.63 (NIST: critical values of the chi-square distribution)
- In this case: 16 > 6.63 → SRM detected (p ≈ 0.00006)
Common causes of SRM:
- Broken randomization: Users aren’t being assigned correctly to groups
- Timing issues: Variations don’t start at the same time
- Bot filtering: Automatic systems incorrectly removing real users
- Redirect problems: If variation B uses a redirect that crashes or is slow
- Cookie/tracking issues: Users blocking or deleting cookies
Tools:
- Lukas Vermeer’s SRM Checker
- Most A/B testing platforms now include built-in SRM alerts
What to do if SRM is detected:
Don’t trust your results. The standard approach is:
- Identify the root cause
- Fix it
- Rerun the test
Your data is compromised and any conclusions you draw are potentially invalid.
4. Never Stop a Test Just Because It’s “Significant”
This is called peeking (optional stopping), a common form of p-hacking, and it’s one of the worst mistakes in A/B testing.
The problem:
If you continuously monitor your test and stop as soon as you see p < 0.05, you’re dramatically increasing your false positive rate. You might see “significance” due to random fluctuations, not real effects.
The rule:
Wait for BOTH:
- Your predetermined sample size
- Your minimum test duration (2 weeks)
Why this is hard:
Stakeholders get impatient. Business pressure builds. You see early “wins” and want to ship. Resist. The cost of implementing a change that doesn’t actually work (or worse, hurts conversion) is far higher than waiting a few more days.
Sequential testing alternative:
If you absolutely need to check results early, use proper sequential testing methods (like Sequential Probability Ratio Test) that are designed for continuous monitoring. But don’t just “peek” at standard A/B tests.
5. Aim for 95% Confidence and 80% Power Minimum
These are two different but equally important metrics.
Confidence Level (typically 95%):
It sets how often you accept a false alarm:
- 95% confidence means: if there’s truly no difference, you’ll incorrectly detect one only 5% of the time (Type I error)
- 99% confidence is more conservative but requires larger samples
- 90% is sometimes acceptable for low-risk tests
Statistical Power (typically 80%):
This is the probability of detecting a real effect if one exists.
- 80% power means: if there IS a real difference, you’ll detect it 80% of the time
- Low power = high risk of false negatives (Type II error)
- 90% power is better but requires larger samples
The calculation:
For a conversion rate test with:
- Baseline: 5% conversion
- MDE: +1 percentage point
- Confidence: 95%
- Power: 80%
You need roughly 7,500–8,200 visitors per variant depending on the formula (Evan Miller’s calculator: about 8,150).
Common mistake:
Many people only check confidence and ignore power. This leads to “no difference” conclusions when there actually is a difference—you just didn’t have enough data to detect it.
6. Perform Sanity Checks on Invariant Metrics
Before trusting your results, verify that metrics that shouldn’t change haven’t changed.
What are invariant metrics?
Metrics that should theoretically be unaffected by your test variation.
Examples:
- If you’re testing a button color on a product page, your total pageviews shouldn’t change
- If you’re testing checkout flow, your add-to-cart rate (before checkout) shouldn’t change
- Number of sessions per user should remain stable
Why this matters:
If invariant metrics change, it’s a red flag that something is wrong with your test implementation:
- Technical bugs
- Tracking errors
- Targeting issues
- Cookie problems
What to check:
- No external shocks: Were there any campaigns, bugs, traffic spikes, or events during the test?
- Stable traffic sources: Did the mix of traffic sources remain consistent?
- No changes to other parts of the site: Nothing else was deployed that could affect results?
- Consistent user experience: Both variations load at the same speed? No errors?
Example of catching implementation bugs:
At one company, they noticed that pageviews increased in the test variation. This made no sense for a button color test. Investigation revealed that the variation was causing an extra page reload due to a JavaScript error. Without this sanity check, they would have trusted corrupted data.
7. Understand Your Test Statistics (But Keep It Simple)
You don’t need to be a statistician, but you should understand the basics.
For conversion rate tests:
The z-statistic is: z = (p₁ – p₂) / SE
Where SE (Standard Error) is: SE = √[p(1-p) × (1/n₁ + 1/n₂)]
- p = pooled conversion rate
- p₁, p₂ = conversion rates for each group
- n₁, n₂ = sample sizes
If |z| > 1.96 → significant at 95% confidence level
Chi-squared test alternative:
χ² = Σ[(Observed – Expected)² / Expected]
Both methods work. Chi-squared is often easier for contingency tables.
Most important principle:
Statistical significance ≠ business impact
A test can be statistically significant (p < 0.05) but have such a small effect that it’s not worth implementing. Always consider:
- Is the lift meaningful for the business?
- What’s the implementation cost?
- What are the risks?
Additional Best Practices
Avoid multiple testing problems:
If you test multiple variations or multiple metrics, adjust your significance threshold. The Bonferroni correction is conservative but simple: divide your alpha by the number of comparisons.
One change at a time:
Test one variable at a time when possible. If you change both the button color AND the copy, you won’t know which drove the change.
Document everything:
- Hypothesis
- Sample size calculation
- Test duration
- Implementation details
- Results and decision
Pre-register your analysis plan:
Decide ahead of time:
- What metrics you’ll measure
- What sample size you need
- How long you’ll run the test
- What will constitute success
This prevents post-hoc rationalization and HARKing (Hypothesizing After Results are Known).
Common Pitfalls to Avoid
- Testing too many things at once: Multiple concurrent tests can interact
- Changing the test mid-flight: Don’t modify variations or targeting during a test
- Trusting small samples: Even if “significant,” small samples are unreliable
- Ignoring seasonality: Don’t run tests that span major holidays or events
- Not documenting learnings: Failed tests teach you as much as winners
The Bottom Line
A/B testing isn’t complicated, but it’s unforgiving with those who cut corners on statistical rules.
The four most critical rules:
- Calculate sample size before starting
- Test for minimum 2 weeks
- Check for Sample Ratio Mismatch
- Never stop early just because it’s “significant”
Get these right, and your tests will be reliable. Skip them, and you’re just generating noise.
Statistics checked against the ASA statement on p-values and the NIST e-Handbook. The principles come from 10 years of hands-on tracking and analytics work for telecom, travel and e-commerce companies.
Sources
- AB Tasty – How Long Should You Run an A/B Test? https://www.abtasty.com/blog/how-long-run-ab-test/
- AB Tasty – The Truth Behind the 14-Day A/B Test Period https://www.abtasty.com/blog/truth-behind-the-14-day-ab-test-period/
- AB Tasty – Sample Ratio Mismatch https://www.abtasty.com/blog/sample-ratio-mismatch/
- Kameleoon – Are You Stopping Your A/B Tests Too Early? https://www.kameleoon.com/blog/stopping-ab-tests-too-early
- Microsoft Research – Diagnosing Sample Ratio Mismatch in A/B Testing https://www.microsoft.com/en-us/research/articles/diagnosing-sample-ratio-mismatch-in-a-b-testing/
- Convert.com – How to Prevent Sample Ratio Mismatch in Your A/B Tests https://www.convert.com/blog/a-b-testing/sample-ratio-mismatch-srm-guide
- GuessTheTest – The Ultimate Guide to Correctly Calculating A/B Testing Sample Size and Test Duration https://guessthetest.com/calculating-sample-size-in-a-b-testing-everything-you-need-to-know/
- VWO – Sample Ratio Mismatch Glossary https://vwo.com/glossary/sample-ratio-mismatch/
- Analytics Toolkit – What is Sample Ratio Mismatch (SRM)? https://www.analytics-toolkit.com/glossary/sample-ratio-mismatch/
- Evan Miller – Sample Size Calculator https://www.evanmiller.org/ab-testing/sample-size.html
- Wikipedia – Sample Ratio Mismatch https://en.wikipedia.org/wiki/Sample_ratio_mismatch