End-to-End A/B Test Design for a Checkout Flow Change
Statistics & ExperimentsModel answerLast updated
Design, run, and analyze a controlled experiment on a checkout page redesign, covering power calculations, guardrails, identity, sequential testing, and subgroup decisions.
Redesigning the Checkout Flow: Full Experiment Design
Your product team wants to ship a redesigned checkout page intended to increase the share of visitors who complete a purchase within 7 days of their first visit. Before anything goes live, you need to design and analyze a rigorous experiment.
Setup
- Primary metric: 7-day paid conversion rate, measured at the user level
- Baseline conversion rate: 6.0%
- Target improvement: +5% relative (i.e., from 6.0% to 6.3%)
- Significance level: α = 0.05 (two-sided)
- Statistical power: 80%
- Daily unique visitors: 200,000; 60% first-time, 40% returning
- Device split: 60% mobile, 30% desktop, 10% tablet
- Additional context: some users visit on multiple devices; bot traffic must be filtered out; a portion of visitors arrive from paid acquisition campaigns and likely have different purchase intent than organic visitors
Your tasks
-
Calculate the per-variant sample size needed and the minimum test duration, both with and without CUPED — assuming CUPED achieves a 20% variance reduction. State your assumptions clearly.
-
Define guardrail metrics (for example, SRM, bounce rate, revenue per user) and describe how you would detect a sample-ratio mismatch in near real time.
-
Choose a randomization unit (cookie, visitor ID, or account), explain how you handle cross-device identity, and describe what steps prevent treatment contamination.
-
Plan a sequential monitoring strategy that controls the Type I error rate. Describe your alpha-spending approach and write out a concrete, pre-registered stopping rule.
-
Describe how you would test for heterogeneous treatment effects across device type and traffic source. If the average treatment effect is near zero but mobile users show a statistically significant positive lift, walk through the reasoning and decision process you would follow.
-
Outline how you would present the final results — effect sizes, confidence intervals, and a clear framework for deciding whether to ship, iterate, or halt.
Where useful, show your math. State assumptions explicitly. Call out common mistakes and practical complications.
Hints
Hint 1
For the sample size formula, remember you are comparing two proportions, not means. Variance for a proportion p is p(1−p), and you need to sum the two arms. CUPED reduces variance multiplicatively, so the required n scales by the same factor — but think carefully about what fraction of your users actually have pre-experiment history for CUPED to use.
Hint 2
SRM is not just a one-time check at the end. Think about how to run a goodness-of-fit test continuously without inflating false-positive rates. Also think about where in the funnel the mismatch could be introduced — assignment, logging, or filtering — because the root cause shapes how you respond.
Hint 3
A neutral average treatment effect with a significant subgroup effect is a classic interpretation trap. Before declaring a mobile win, ask whether the interaction term (treatment × device) is itself significant, whether the finding was pre-registered, and whether desktop is showing a hidden negative effect that the mobile lift is masking.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
Approach
Work through each task in order, stating assumptions as you go. Interviewers are evaluating both your statistical mechanics and your practical judgment — know where the formulas break down and say so.
1. Sample Size and Test Duration
Formula. For two proportions p₁ = 0.060 and p₂ = 0.063, the absolute difference is Δ = 0.003. Using z₀.₀₂₅ = 1.96 and z₀.₂₀ = 0.842:
n = (1.96 + 0.842)² × [p₁(1−p₁) + p₂(1−p₂)] / Δ²
= 7.849 × (0.0564 + 0.0590) / 0.000009
≈ 100,700 users per variant (~201,400 total)
With CUPED. Variance reduction of 20% means n scales by 0.80, giving roughly 80,600 per variant (~161,200 total).
Important caveat on CUPED: 60% of visitors are first-time users with no pre-experiment history. For them, CUPED has nothing to adjust on. The realized variance reduction will be well below 20% — possibly closer to 8–12% — unless you substitute other pre-treatment covariates (device, traffic source, geo, session depth) that exist for everyone. Use a covariate-adjusted regression (ANCOVA-style) that degrades gracefully when history is missing.
Duration. Three clocks run simultaneously:
- Enrollment clock: how long it takes to collect the required distinct users. At 100% allocation you hit ~100k per arm in roughly one day; at 10% allocation you need about 10 days.
- Seasonality floor: pricing intent differs on weekdays vs. weekends. Round up to whole weeks; the minimum is 7 days regardless of the math.
- Outcome maturation: the metric is 7-day conversion, so the last enrolled user needs 7 more days before their outcome is known.
| Allocation | Without CUPED | With CUPED |
|---|---|---|
| 100% of traffic | ~1 day enroll + 7 days maturation = ~14 days total | same |
| 10% of traffic | ~10 days enroll + 7 days = ~21 days total | ~8 days enroll + 7 days = ~21 days total |
The enrolled-user count is not simply daily traffic × days; returning users repeat, so track distinct enrolled IDs. Bot filtering shrinks the eligible pool, so inflate your target n by the expected bot rate before setting the timeline.
2. Guardrails and SRM Detection
Guardrail metrics to pre-register with non-inferiority margins:
- Revenue per user at 7 and 30 days — a layout can raise conversion by steering users toward cheaper plans
- Average revenue per paying user and plan-tier mix
- Bounce rate and time-to-first-interaction on the checkout page
- 30-day refund and cancellation rate — catches post-purchase regret from a confusing layout
- Page load time and JavaScript error rate
- Checkout-step error rate and support contacts per user
- Bot-flag rate per arm — this should be equal; asymmetry suggests a filtering bug
SRM detection. Run a chi-square goodness-of-fit test comparing observed assignment counts to expected counts (50/50 or whatever your split is). Key practices:
- Compute it hourly on cumulative counts; alert at p < 0.001 to account for repeated testing
- For continuous validity, prefer a sequential test such as an mSPRT or a Bayesian Dirichlet-multinomial approach
- When SRM fires, break it down by device, browser, traffic source, and new/returning to localize the root cause — a common culprit is a redirect or caching rule that silently drops one arm on a specific platform
- If SRM fires, pause metric analysis immediately; the assignment distribution being broken makes every downstream result uninterpretable
3. Randomization Unit, Identity, and Contamination
Unit of randomization. Use the logged-in account ID when available. For anonymous visitors, use a durable first-party visitor ID (set in a first-party cookie or localStorage). On login, stitch the visitor ID to the account and inherit the earliest assignment — never re-randomize a user who has already been assigned.
Cross-device. Most users who visit on multiple devices will eventually log in, resolving identity. Analyze on an intent-to-treat basis keyed to first assignment. Track the share of users exposed to both variants; if it exceeds roughly 2–3%, include a sensitivity analysis excluding those users alongside the primary analysis. Never drop them post hoc from the primary result.
Contamination controls:
- Make CDN cache keys variant-aware so cached pages don't bleed across arms
- Filter employees and internal IPs before assignment, not after
- Apply bot-filtering rules identically in both arms using pre-specified, auditable rules
- Audit paid-ad destination URLs to ensure they don't hardcode a variant parameter
4. Sequential Monitoring and Stopping Rules
Use Lan–DeMets O'Brien–Fleming alpha spending with 4 planned looks at 25%, 50%, 75%, and 100% of the target sample. Only take a look on matured cohorts (7-day outcomes available) and at whole-week boundaries to avoid weekday/weekend confounding.
Approximate two-sided critical values: z ≈ 4.05, 2.86, 2.34, 2.02. The required maximum sample size inflates by roughly 2% relative to a fixed-horizon design — a small price for the ability to stop early.
Pre-registered stopping rule:
- Stop for efficacy: |z| exceeds the boundary at a look, all guardrails pass within their non-inferiority margins, and there is no active SRM
- Stop for harm: the primary metric or any guardrail crosses a pre-specified harm threshold (for example, the 95% CI for revenue per user lies entirely below −1%)
- Futility (non-binding): consider stopping if conditional power falls below 10% at the 50% or 75% look
- Default: if none of the above triggers, run to the planned maximum and analyze once
A common mistake is to peek at results outside the pre-registered schedule and act on what you see. If you do look informally, document it and do not let it influence the decision unless a formal boundary is crossed.
5. Heterogeneity Analysis
Pre-register segments before the experiment starts: device type (mobile / desktop / tablet), traffic source (paid vs. organic), and new vs. returning visitor. Segment membership must be defined by pre-treatment attributes — the device at first exposure, not any device used during the experiment.
Method. Fit a regression with treatment, segment indicators, and treatment × segment interaction terms. Test the set of interactions jointly with an F-test or likelihood-ratio test before looking at individual segments. Apply Holm or Benjamini–Hochberg correction across the pre-registered segments.
Power reality check. Mobile is ~60% of traffic, so it has reasonable power. Tablet at ~10% is nearly uninformative for detecting a realistic effect size.
If the ATE is neutral but mobile shows a significant lift:
- Check the interaction term first. Is the mobile coefficient actually significantly different from the desktop coefficient? A "significant mobile subgroup" that is not significantly different from other segments is weak evidence.
- Look at the directional pattern. A neutral average often means desktop or tablet is negative. If so, shipping universally harms those segments.
- Evaluate plausibility. Does the redesign fix a known mobile-specific usability issue? A mechanism makes the finding more credible.
- Check pre-registration and multiple-testing correction. A finding that was pre-registered and survives Holm correction is materially stronger than a post-hoc discovery.
- Decision path. If pre-registered, survives correction, has a mechanism, and non-mobile segments show no harm: ship to mobile only with a small holdout for ongoing monitoring. If post-hoc: treat it as a hypothesis and run a confirmatory mobile-only experiment with its own prospective power calculation.
6. Analysis and Communication
Reporting the primary result. Present the absolute difference in conversion rates (percentage points) with a 95% CI, and the relative lift with a CI derived via the delta method. Show the CUPED-adjusted estimate alongside the unadjusted one — they should agree directionally; large divergence warrants investigation.
At the target n of ~100,700 per arm, the 95% CI half-width is approximately ±0.21 pp. A true +0.3 pp lift should yield a CI that clears zero with margin. Be explicit about this when presenting: if the CI is [0.01, 0.59], that is a wide range spanning "negligible" to "meaningful."
Decision framework:
| Outcome | Action |
|---|---|
| Primary metric positive, guardrails pass, no SRM | Ship |
| Primary metric positive, guardrail degraded | Iterate — fix the guardrail issue before shipping |
| Primary metric neutral, mobile subgroup positive (pre-registered) | Ship to mobile; run confirmatory test for other segments |
| Primary metric neutral, no credible subgroup signal | Halt or redesign; the change had no effect |
| Any guardrail crosses harm boundary | Halt immediately regardless of primary metric |
Stakeholder communication. Lead with the business outcome in plain language before showing statistics. Provide absolute and relative effect sizes — relative lifts look more impressive but can mislead; always anchor to the absolute number. Include a brief section on what the experiment cannot tell you: long-run retention effects, cross-sell impact, and the behavior of user segments too small to measure reliably.