Markdown Editor

A/B Test Plan Template

Pre-registered A/B test: hypothesis, randomisation unit, metrics, Lehr sample size, SRM and peeking rules, novelty, privacy and consent, decision rule, results

产品与项目标准Kohavi, Tang and Xu 2020 (online controlled experiments); Lehr 1992 sample size ruletestplanmath

使用方法: Use it before exposing any user to an experiment. Fill the hypothesis, primary metric, sample size and decision rule first and get them approved. The main pitfall is peeking and stopping early, or skipping the sample ratio mismatch check.

预览

Experiment Plan: [feature / change]

A pre-registered plan for one online controlled experiment (A/B test): hypothesis, randomisation unit, metrics, sample size, duration, trust checks, decision rule and results. Write and approve it before the experiment starts; decide the success criteria before looking at the data, or you will rationalise whatever you see. Practice follows Kohavi, Tang and Xu, Trustworthy Online Controlled Experiments (Cambridge University Press, 2020) and Lehr's sample size rule of thumb (1992). Replace every [bracketed] value and every row marked Example. The privacy section is a documentation aid, not legal advice.

Document control

FieldValue
Experiment ID[EXP-NNN]
Experiment name[Short descriptive name]
Version[0.1]
Status[Design / Approved / Running / Analysing / Decided]
Owner[@product-manager]
Analyst[@analyst]
Engineering contact[@engineer]
Approvers / reviewers[@product-lead, @data-lead, @privacy-contact]
Planned startYYYY-MM-DD
Planned endYYYY-MM-DD
Last updatedYYYY-MM-DD
Classification[Internal]

Approvals

RoleNameDecisionDate
Product lead[@name][Approved / Changes requested]YYYY-MM-DD
Data or analytics lead[@name][Approved / Changes requested]YYYY-MM-DD
Privacy contact[@name][Approved / Changes requested]YYYY-MM-DD

Revision history

VersionDateAuthorChange
0.1YYYY-MM-DD[@owner]First draft of the plan
[1.0]YYYY-MM-DD[@owner][Approved before launch; plan frozen]
[1.1]YYYY-MM-DD[@analyst][Results and decision added]

1. Hypothesis

We believe [change] will cause [primary metric] to [increase / decrease] by at least [minimum effect] for [population] because [mechanism, grounded in research or data].

Example: We believe replacing the empty first screen with a three-step template picker will raise seven-day activation (a new account creates and saves a second note within seven days) from 20% to at least 22% for new web sign-ups, because interview research (RES-031) showed that new users do not know what to write first.

Null hypothesis: the change has no effect on the primary metric. Alternative: the change moves it in either direction (two-sided test). A two-sided test is the safe default because a change can also hurt.

2. Variants and randomisation

VariantChangeAllocation
Control[Current experience][50%]
Treatment A[Change][50%]
Example: ControlEmpty first screen50%
Example: Treatment AThree-step template picker on first screen50%
Design decisionValue
Randomisation unit[User account / device / session / page view] Example: user account
Analysis unit[Same as randomisation unit, or state the correction used] Example: user account
Assignment method[Deterministic hash of unit ID and experiment salt]
Assignment point[Example: at first page view after sign-up, before the first screen renders]
Exposure logging[Example: event experiment_exposed with experiment ID and variant]
Interference risk[Example: low; notes are private, no network effects between users]
Concurrent experiments[List overlapping tests and whether they share users]

Questions to answer before launch:

  • Does a user always see the same variant across devices and sessions?
  • Are users counted from the moment of assignment, not only if they reach the changed screen (to avoid a biased "triggered" population)?
  • If the unit is a session or page view but the metric is per user, how will you correct the variance (for example the delta method)?
  • Could users in different arms affect each other (shared documents, marketplaces, social features)? If yes, consider cluster randomisation.

3. Population and exclusions

  • Included: [population]. Example: new accounts created on the web app in the test window, all regions where the app is offered.
  • Excluded: [internal staff accounts, test accounts, known bots, users who opted out of experiments].
  • Pre-declared subgroups: [list, with the reason each matters]. Example: desktop versus mobile web; users who arrived from the template gallery versus from search.

Subgroup results are exploratory unless the plan sized the experiment for them. Report them, but do not ship on a subgroup win when the overall result is flat.

4. Metrics

IDTypeMetricDefinition linkDirectionThreshold
M-1Primary[Metric][link][up / down][minimum effect]
M-2Guardrail[Metric][link][no worse than][tolerance]
M-3Diagnostic[Metric][link]informationaln/a
M-1 (Example)PrimarySeven-day activation rateMET-007upat least +2.0 percentage points
M-2 (Example)GuardrailSupport tickets per 1,000 new accountsMET-012no worse than+10% relative
M-3 (Example)GuardrailFirst-screen load time, 75th percentileMET-020no worse than+100 ms
M-4 (Example)DiagnosticTemplate picker click-throughMET-031informationaln/a

Define metrics in Metric Definition (data/metric-definition) and the events behind them in the Analytics Tracking Plan (data/analytics-tracking-plan).

5. Sample size and duration

Inputs:

  • Baseline value of the primary metric: [N%]
  • Minimum detectable effect (absolute): [delta]
  • Significance level: two-sided alpha = [0.05]
  • Power: [80%]
  • Eligible traffic per day: [N units]

Quick estimate with Lehr's rule (Lehr, 1992), per arm, for two equal arms:

n=16 σ2δ2n = \frac{16\,\sigma^2}{\delta^2}

  • delta is the absolute difference you want to detect.
  • sigma^2 is the variance of the metric. For a rate (proportion), use p(1 - p) where p is the average of the baseline and the target rate.
  • The constant 16 is valid only for a two-sided alpha of 0.05 and 80% power: it rounds 2 x (1.96 + 0.84)^2, which is about 15.7. For 90% power the constant is about 21. For other designs (unequal arms, more than two arms, ratio metrics), use a proper power calculation.

Example: baseline 20%, target 22%, so p = 0.21 and sigma^2 = 0.21 x 0.79 = 0.1659. With delta = 0.02, n = 16 x 0.1659 / 0.0004 = 6,636 new accounts per arm, 13,272 in total. At 1,000 eligible sign-ups per day, split 50/50, that is 13.3 days, rounded up to 14 days (two full weeks). The exact normal-approximation formula for two proportions (variance 0.20 x 0.80 and 0.22 x 0.78 in the arms) gives about 6,510 per arm, so the rule of thumb is slightly conservative here.

ItemValue
Required sample per arm[N]
Expected duration[N days, whole weeks]
Planned end dateYYYY-MM-DD
Example: required sample per arm6,636 accounts
Example: expected duration14 days

6. Trust checks and analysis rules

6.1 Sample ratio mismatch (SRM). Compare the observed count per arm with the planned allocation using a chi-square goodness-of-fit test. If the p-value is below the agreed threshold [for example 0.001], stop the analysis: assignment or logging is broken and the metric results cannot be trusted until the cause is found.

Example: control 7,050 and treatment 6,950 accounts against an expected 7,000 each gives chi-square = 0.71 with 1 degree of freedom, p = 0.40: no mismatch.

6.2 A/A or pre-period check. [Run an A/A test on the same assignment code, or compare the arms on a pre-experiment metric, to confirm that the pipeline does not produce false differences.]

6.3 No peeking. This plan uses a fixed horizon: the primary metric is tested once, at the planned end. Dashboards may be watched for guardrail breaches and bugs, but the experiment is not stopped early because the primary metric looks good. If early stopping for success is needed, name a sequential method here before launch [for example a group sequential design with an alpha spending function], with its planned looks.

6.4 Novelty and primacy effects. Users may click a new element because it is new, or resist it because it is unfamiliar. Plot the treatment effect by day and by exposure cohort. If the effect decays steadily, extend the run or plan a holdout before shipping.

6.5 Multiple comparisons. With more than one treatment arm, or more than one primary metric, adjust the significance level [for example Holm or Bonferroni] and state which.

6.6 Analysis method. [Example: difference in proportions with a 95% confidence interval (normal approximation); guardrails tested one-sided against their tolerance.]

7. Privacy, consent and ethics

Rules on storing or reading identifiers on a user's device, and on processing personal data, differ by jurisdiction. Examples, as of October 2026 (check the current official text):

  • EU: Article 5(3) of the ePrivacy Directive (2002/58/EC) requires consent for storing or accessing information on a user's device unless it is strictly necessary for a service the user requested. The EDPB Guidelines 2/2023 (version 2.0, 16 October 2024) explain its technical scope. Processing of personal data also falls under the GDPR.
  • UK: the Data (Use and Access) Act 2025 (section 112 and Schedule 12) added exceptions to the PECR consent rule, in force from 5 February 2026 as reported by law firm commentary (check legislation.gov.uk). ICO guidance on storage and access technologies lists splitting users into two groups to compare website versions as likely to fit the statistical purposes exception, if information is aggregate, users get clear information and a free, simple way to object, and the data is used only to improve the service.
  • US: there is no single federal cookie rule; state privacy laws (for example in California) set notice and opt-out duties.

Questions for the privacy contact:

  • Which identifier assigns the variant, and is it stored on the device? Does the consent banner or notice cover it?
  • Are users who refused analytics consent excluded or served the control experience without tracking?
  • Is a data protection impact assessment needed (see compliance/dpia)?
  • Does any arm change price, eligibility, or safety-relevant information? If so, record the ethics review and who approved it.
  • How long is experiment-level data retained after the decision?

8. Decision rule

OutcomeAction
SRM or other trust check failsDiscard the result, fix the cause, rerun
Any guardrail breachedStop, revert, investigate
Primary up, confidence interval excludes zero, guardrails within toleranceShip the variant
Primary interval includes zero, guardrails fineDo not ship; record the learning; decide whether a larger test is worth it
Primary downRevert; record the learning

9. Results (fill after the planned end)

VariantUnitsPrimary metricGuardrailsVerdict
Control[N][value][values]
Treatment A[N][value][values][Ship / Do not ship / Rerun]
Example: Control7,0501,410 activated (20.0%)Tickets 4.1 per 1,000; load p75 820 msBaseline
Example: Treatment A6,9501,536 activated (22.1%)Tickets 4.3 per 1,000; load p75 860 msShip

Example: difference +2.1 percentage points, 95% confidence interval +0.8 to +3.5 points (z = 3.05, two-sided p = 0.002). Both guardrails stayed within tolerance (+4.9% tickets against +10%; +40 ms against +100 ms). The daily effect did not decay over the two weeks.

Deviations from the plan: [none / describe].

10. Learnings

  • What this changes in the roadmap: [link to product/roadmap item]
  • What we learned about users: [insight]
  • Follow-up experiments: [EXP-NNN]

Related templates: Product Launch Checklist (product/launch-checklist), Prioritization (product/prioritization).

11. References

Standard and licence note

Based on published online experimentation practice (Kohavi, Tang and Xu, 2020) and Lehr's published sample size approximation. The legal examples summarise public EU and UK texts as of October 2026 in original words; this is not legal advice, so check the current official text and your privacy contact. The books are cited, not reproduced:

All template text is original. Template licence: MIT.

相关模板