Size a Two-Stage Funnel A/B Test on Checkout Flow
Statistics & ExperimentsModel answerLast updated
Calculate the required sample size for an A/B test when the primary metric is a rare downstream conversion event in a multi-step funnel.
Scenario
You are a data scientist at an e-commerce company. The product team wants to test a redesigned checkout flow (variant B) against the current flow (variant A).
The funnel has two stages:
- Add-to-cart → Checkout page (most users reach this)
- Checkout page → Purchase completed (the rare, high-value event)
The primary success metric is purchase conversion rate (purchases / unique visitors entering the checkout flow).
Known baseline figures (from the last 90 days)
| Metric | Value |
|---|---|
| Daily unique visitors entering checkout | ~50,000 |
| Baseline purchase conversion rate | 3.2% |
| Average revenue per converted user | $85 |
Test parameters requested by the team
- Detect a minimum absolute lift of 0.4 percentage points (i.e., 3.2% → 3.6%)
- Two-sided test
- Significance level α = 0.05
- Statistical power 1 − β = 0.80
What is expected of you
- Calculate the required sample size per variant using the standard formula for comparing two proportions.
- Determine how many days the experiment must run (50/50 traffic split).
- Identify at least two practical risks or corrections that should be considered before finalising the design (e.g., multiple comparisons, novelty effect, variance inflation).
- State a brief business sanity check: is the potential revenue uplift large enough to justify the experiment duration?
Hints
Hint 1
Start from the standard two-proportion z-test sample size formula: n = (z_α/2 + z_β)² × [p₁(1−p₁) + p₂(1−p₂)] / (p₁−p₂)². Plug in the z-scores for α=0.05 two-sided and 80% power.
Hint 2
After computing n per variant, divide total daily visitors by 2 (50/50 split) to get daily visitors per variant, then compute ceiling(n / visitors_per_variant) for experiment duration.
Hint 3
Think about what can go wrong: low event rate means high variance, novelty effects inflate early results, and if the team also tracks secondary metrics there is a multiple comparisons problem.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Step 1 — Recall the Formula
For comparing two independent proportions, the per-variant sample size is:
$$n = \frac{(z_{\alpha/2} + z_{\beta})^2 \cdot [p_1(1-p_1) + p_2(1-p_2)]}{(p_1 - p_2)^2}$$
Z-score look-ups:
- Two-sided α = 0.05 → z_{α/2} = 1.96
- Power 80% → z_β = 0.84
- (z_{α/2} + z_β)² = (1.96 + 0.84)² = (2.80)² = 7.84
Step 2 — Define the Parameters
| Parameter | Value |
|---|---|
| p₁ (control rate) | 0.032 |
| p₂ (variant rate) | 0.036 |
| Absolute difference | 0.004 |
| Relative lift | 12.5% |
Variance terms:
- p₁(1 − p₁) = 0.032 × 0.968 = 0.030976
- p₂(1 − p₂) = 0.036 × 0.964 = 0.034704
- Sum = 0.065680
Step 3 — Compute Sample Size per Variant
$$n = \frac{7.84 \times 0.065680}{(0.004)^2} = \frac{0.51493}{0.000016} \approx 32,183$$
Required per variant: ~32,200 users (always round up).
Total experiment size: ~64,400 users.
Step 4 — Determine Run Duration
- Daily visitors entering checkout: 50,000
- Per variant (50/50 split): 25,000/day
- Days needed: ⌈32,200 / 25,000⌉ = 2 days (approximately)
Wait — flag this immediately. Two days is dangerously short. Even though the math is satisfied, a minimum of 1–2 full week cycles (7–14 days) is required to capture weekly seasonality in purchasing behaviour. A practical recommendation is to run for at least 14 days, which will comfortably exceed the statistical requirement while avoiding day-of-week bias.
Step 5 — Practical Risks and Corrections
Risk 1: Multiple Comparisons (Family-Wise Error Rate)
If the team also tracks secondary metrics — cart abandonment rate, average order value, time-on-page — each additional test at α = 0.05 inflates the false-positive rate. With 5 metrics the probability of at least one spurious significant result is roughly 1 − 0.95⁵ ≈ 23%.
Correction: Pre-register exactly one primary metric. Apply a Bonferroni or Benjamini-Hochberg correction if secondary metrics must also be tested, or treat secondary metrics as directional/exploratory only.
Risk 2: Novelty Effect
Users who frequently visit checkout may respond positively to any change simply because it is new, inflating early conversion rates. This effect typically decays after a week.
Correction: Segment results by new vs. returning users. Inspect the conversion time-series; if the variant's lift is concentrated in the first 2–3 days and then flattens, the effect is likely a novelty artefact rather than a genuine improvement.
Risk 3: Low Base Rate and Variance Inflation
At 3.2% conversion the outcome is a Bernoulli variable with high relative variance. Small absolute differences are hard to detect reliably, and a single large promotional event (flash sale, holiday) during the test window can shift both variants unpredictably.
Correction: Avoid running the test over known promotional periods. Consider using CUPED (Covariate-Adjusted Residuals for Pre-Experiment data) to reduce variance by controlling for each user's pre-experiment purchase history, which can reduce required sample size by 15–30%.
Risk 4: Network/Interference Effects
If users share cart links or promotional codes, treatment can "leak" into the control group, biasing results toward zero (dilution) or toward an overestimate.
Correction: Confirm that randomisation is at the user (cookie/account) level, not at the session level, to prevent the same user from seeing both variants.
Step 6 — Business Sanity Check
Incremental daily purchases from a 0.4 pp lift:
- Incremental converters per day = 50,000 × 0.004 = 200 users/day
- Incremental daily revenue = 200 × $85 = $17,000/day
Over a 14-day test at a 50/50 split, the variant receives ~25,000 visitors/day. Expected incremental revenue generated just during the test:
- 25,000 × 0.004 × $85 × 14 days ≈ $119,000
If the lift is real and the variant is fully rolled out, the annualised incremental revenue is:
- 50,000 × 0.004 × $85 × 365 ≈ $6.2 million/year
This is a very strong business case. A 14-day experiment is easily justified.
Summary of Answers
| Question | Answer |
|---|---|
| Sample size per variant | ~32,200 users |
| Experiment duration (statistical minimum) | ~2 days |
| Recommended run time | 14 days (two full week cycles) |
| Key corrections | Multiple comparisons, novelty effect, CUPED variance reduction, user-level randomisation |
| Annualised revenue at stake | ~$6.2M |
Common Mistakes to Avoid
- Using a one-sided test to get a smaller sample size without strong prior directional justification — this is p-hacking by design.
- Peeking at results daily and stopping as soon as p < 0.05 — this inflates the false-positive rate substantially; use a sequential testing framework (e.g., always-valid p-values) if early stopping is genuinely needed.
- Forgetting to account for the difference between visitors and unique users; if the same person visits checkout multiple times, the unit of randomisation and the unit of analysis must be consistent.