A/B Testing: Designing Experiments and Measuring Impact
Learn how to design and run A/B tests: define hypotheses, calculate sample sizes, avoid common mistakes, and analyze results with statistical rigor.
A/B Testing: Designing Experiments and Measuring Impact
A/B testing (split testing) compares two or more variants to determine which performs better. Done well, it provides rigorous, data-driven decisions for product and marketing changes.
---
What Is A/B Testing?
- Control (A): Current version or baseline.
- Treatment (B): New version or variant being tested.
- Users are randomly assigned to control or treatment.
- A metric is measured for each group.
- Statistical tests determine whether observed differences are real or due to chance.
When to Use A/B Testing
| Good Use Cases | Poor Use Cases |
|---|---|
| UI changes (buttons, layout) | Very rare events (few conversions) |
| Pricing experiments | Long-term effects (network effects) |
| Email subject lines | When you need causal mechanisms |
| Onboarding flows | Exploratory discovery (use other methods) |
| Feature rollout decisions |
Designing an Experiment
1. Define the Hypothesis
State what you believe and what you will measure.
- Example: "Changing the CTA from 'Sign Up' to 'Get Started Free' will increase sign-up rate by at least 10%."
- Be specific: define metric, direction, and minimum effect of interest.
2. Choose the Metric
| Metric Type | Examples |
|---|---|
| Primary | Conversion rate, revenue per user, sign-up rate |
| Secondary | Engagement, retention, time on page |
| Guardrail | Bounce rate, support tickets, unsubscribe rate |
3. Calculate Sample Size
Use a sample size calculator with:
- Baseline conversion rate (or mean for continuous metrics)
- Minimum detectable effect (MDE) — smallest change you care about
- Statistical power (e.g., 80%)
- Significance level (e.g., α = 0.05)
- One- vs two-sided test
4. Randomize
Assign users randomly to control and treatment. Ensure:
- Randomization is unbiased (e.g., by user ID hash).
- Same user always sees same variant (no switching).
- No leakage between variants (e.g., through shared caches).
Running the Test
Duration
- Run until you reach the planned sample size.
- Avoid stopping early when results "look good" — this inflates false positive rate.
- Consider seasonality; run for full weeks or cycles if possible.
Sample Size Calculator
Inputs: baseline rate, MDE, power, α. Output: sample size per variant. Double for control + treatment.
Avoiding Peeking
Peeking = checking results before the planned end and stopping when p < 0.05.
- Increases false positives.
- Use sequential analysis or fixed sample size and stick to it.
- If you must peek, use methods that correct for multiple looks (e.g., O'Brien-Fleming).
Analyzing Results
Statistical Test
| Metric Type | Test |
|---|---|
| Proportion (conversion rate) | Chi-squared, Z-test for proportions |
| Continuous (revenue, time) | t-test, Mann-Whitney U |
| Count | Poisson or negative binomial |
p-Value
- Probability of seeing the observed difference (or more extreme) if there were no real effect.
- p < 0.05: Often interpreted as "statistically significant" — reject null of no effect.
- p ≥ 0.05: Do not reject null; effect may be real but not detected with this sample.
Confidence Interval
- Range that likely contains the true effect.
- If 95% CI excludes 0, the effect is typically significant at α = 0.05.
- Prefer confidence intervals over p-values when reporting magnitude.
Effect Size
- Absolute: e.g., 2% vs 2.5% conversion.
- Relative: e.g., (2.5 − 2) / 2 = 25% relative lift.
- Statistical significance ≠ practical importance. Always report effect size.
Common Metrics
| Metric | Definition |
|---|---|
| Conversion rate | Conversions / Visitors |
| Revenue per user | Total revenue / Users |
| Engagement | Clicks, sessions, time on site |
| Retention | Users still active after N days |
Multi-Variant Testing (A/B/C/n)
- Compare more than two variants (A, B, C, …).
- Uses ANOVA or Chi-squared for omnibus test; then pairwise tests with correction (e.g., Bonferroni).
- More variants = larger sample size for same power per comparison.
Common Mistakes
| Mistake | Why It Hurts | Fix |
|---|---|---|
| Stopping too early | Inflated false positive rate | Pre-specify sample size; run to completion |
| Multiple comparisons | Family-wise error increases | Adjust α (Bonferroni) or use sequential methods |
| Selection bias | Non-random assignment | Use robust randomization (e.g., consistent hashing) |
| Novelty effect | Users react to "new" temporarily | Run for sufficient time; consider holdback |
| Ignoring guardrails | Win on primary, lose on secondary | Monitor multiple metrics |
| Testing too many things | Hard to interpret; multiple comparisons | One primary hypothesis per test |
| Wrong unit of randomization | User vs session vs pageview | Match to business unit (usually user) |
Bayesian vs Frequentist A/B Testing
| Approach | Interpretation | Pros |
|---|---|---|
| Frequentist | p-value, CI; "reject or not" | Familiar, many tools |
| Bayesian | Posterior probability, credible intervals | "Probability B beats A"; natural for decision-making |
---
Using the Experiments Module
- Define hypothesis and primary metric.
- Create experiment; set control and treatment(s).
- Use built-in calculator for sample size.
- Configure traffic split and randomization.
- Run until planned sample size.
- View results: p-value, confidence interval, effect size.
- Decide: ship, iterate, or run follow-up test.
Practical Workflow
- Plan: Hypothesis, metric, MDE, power, sample size, duration.
- Implement: Randomization, tracking, no cross-contamination.
- Run: Reach planned sample; avoid peeking.
- Analyze: Appropriate test, p-value, CI, effect size.
- Decide: Statistical + practical significance.
- Document: Report methodology and results for reproducibility.
Quick Reference
| Step | Key Actions |
|---|---|
| Design | Clear hypothesis, one primary metric, sample size |
| Run | Random assignment, no peeking, full duration |
| Analyze | Right test, p-value, CI, effect size |
| Decide | Significance + business impact |
What's Next?
- [Inferential Statistics](/analytics/user-manuals/stats-overview/inferential-statistics) — Hypothesis testing foundations
- [Statistical Tests Guide](/analytics/user-manuals/stats-tools/statistical-tests-guide) — Choosing the right test
- [Effect Size & Power](/analytics/user-manuals/stats-tools/effect-size-power-analysis) — Sample size and power
- [Experiments Overview](/analytics/user-manuals/adv-all/experiments-overview) — Platform experiment tools
Related Articles
Inferential Statistics: Confidence Intervals, Hypothesis Testing, and P-Values
Learn how inferential statistics lets you draw conclusions about populations from samples — confidence intervals, hypothesis testing, p-values, Type I and II errors, and common misconceptions.
Statistical Tests
A complete guide to all 14+ hypothesis tests -- when to use each one, how to run them, and how to interpret results.
Effect Size and Power Analysis: Beyond Statistical Significance
Why p-values aren't enough — learn effect size (Cohen's d, Pearson r, eta-squared), statistical power, sample size planning, and how to avoid underpowered studies and trivial significant results.
Experiment Tracking Overview
What is experiment tracking, creating experiments, comparing runs, metrics logging, model registry, promoting models, and exporting results.
Was this helpful?