A/B testing done right: sample size, duration and pitfalls
An A/B test shows half your visitors version A (the current page) and half version B (the change), at the same time, and compares the results. Because both groups visit in the same period, seasons, campaigns and news affect both equally. That makes it the most reliable way to learn whether a change causes an effect. It is also the easiest method to fool yourself with. This lesson gives you the maths, the rules and the honest alternatives for low traffic.
The four numbers that decide everything
Before a test, you need:
- Baseline conversion rate (p): the current rate of your primary metric. Paws & Co bed pages: purchases per product page view = 2.0%.
- Minimum detectable effect (MDE): the smallest improvement you care to detect. Usually expressed as a relative lift: 20% relative means from 2.0% to 2.4%.
- Significance level: how much risk of a false winner you accept. Standard: 5%.
- Power: the chance of detecting the effect if it really exists. Standard: 80%.
A rule of thumb for sample size
With 5% significance and 80% power, a good approximation of the visitors needed per variant is:
n ≈ 16 × p × (1 − p) ÷ δ²
where δ is the absolute difference you want to detect.
Paws & Co: p = 0.020, target 0.024, so δ = 0.004.
n ≈ 16 × 0.020 × 0.980 ÷ 0.004² = 0.3136 ÷ 0.000016 ≈ 19,600 per variant
That is about 39,200 product page views in total. Bed pages get about 300 views a day:
39,200 ÷ 300 ≈ 131 days
Four months for one test. And that is for a fairly large 20% lift.
What if Paws & Co aims for a bolder change with an expected 40% lift (2.0% → 2.8%, δ = 0.008)?
n ≈ 0.3136 ÷ 0.000064 ≈ 4,900 per variant, 9,800 in total, about 33 days
That is feasible. The lesson: small sites can only test big changes. Halving the effect you want to detect quadruples the traffic you need.
Use an online A/B test sample size calculator to check your numbers; most use a more precise formula than the rule of thumb. Enter your baseline, MDE, 5% significance and 80% power. If the answer is more than 6 to 8 weeks of traffic, choose a bolder change, a higher-traffic page, a metric earlier in the funnel (add to cart instead of purchase), or an alternative method.
Rules for a test you can trust
- Write the plan before you start: hypothesis, primary metric, guardrails, sample size, duration, decision rule.
- Run full weeks. Behaviour differs between weekdays and weekends. Run at least one, preferably two, full business cycles, and until you reach the planned sample size.
- Do not peek and stop. If you check every day and stop when the result looks significant, the chance of a false winner rises far above 5%. Decide the duration in advance and evaluate once at the end. (Some tools use sequential or Bayesian statistics designed for continuous monitoring; then follow that tool's rules, not your gut.)
- Change nothing else on the tested pages during the test, and note campaigns or promotions in your change log.
- Check the split (SRM). If you planned 50/50 and get 5,800 versus 5,000 visitors, something is wrong (redirects, bots, tracking that fails in one variant). A sample ratio mismatch makes the result unreliable; find the cause before you interpret anything.
- Check guardrails before declaring a winner.
- One test per page at a time, unless your tool handles overlapping tests properly.
Reading the result
At the planned end, there are three outcomes:
- B wins on the primary metric, significant, guardrails fine: roll out B. Expect the real effect to be somewhat smaller than measured (winners are often overestimated).
- No significant difference: that is a result too. The change did not have an effect large enough to detect. Keep whichever version is simpler or better for customers, and log what you learned.
- B loses: you avoided rolling out something harmful. Log why you think it lost.
Report the confidence interval, not only "significant yes/no": "B raised add-to-cart rate by +18%, with a 95% interval from +4% to +32%" tells you far more.
An A/B test that changes prices, shows different prices to different visitors, or personalises offers raises extra legal questions (price transparency, consumer law, and in some cases personalised pricing information requirements). Test presentation and information freely; test prices only after checking the rules with your consumer authority's guidance and, if needed, legal advice.
Rules on price presentation, personalised pricing and promotions are enforced per country. Check your consumer authority's guidance before you test anything price-related, for example the ACM (Netherlands), UOKiK (Poland), the DGCCRF (France) or the CMA (UK). Testing tools that set cookies fall under the same consent rules as analytics: check your data protection regulator too.
Tools
Dedicated A/B testing tools include VWO, Optimizely, AB Tasty, Convert, and open-source or product-analytics options such as GrowthBook and PostHog. Google Optimize, once a popular free option, was shut down in 2023. When choosing, check: price at your traffic, whether variants are rendered without flicker, consent handling (testing tools often use cookies to keep visitors in the same variant), and statistics method.
On the platform: whether your shop supports running two page variants at the same time is not something this course can confirm; check in your shop dashboard. For apps you build on my-app.engineer, you control the code: you can ask the builder to split sign-ups between two versions of a page (for example by a random assignment stored with consent) and log which version each visitor saw, then compare in Pulse or your own database.
Honest alternatives when traffic is low
If a proper A/B test would take months:
1. Before/after comparison. Make the change, then compare the same metric for four weeks before and four weeks after. Weaker evidence, because other things change too (season, campaigns), so:
- Compare with the same period last year if you have it.
- Use a control: a similar page or segment you did not change. If both move equally, it was not your change.
- Only trust large effects.
- Write the change date in your log.
2. Test earlier in the funnel. Add-to-cart happens more often than purchase, so tests on it need fewer visitors. Check that purchases do not drop as a guardrail.
3. Test on your highest-traffic page or template. A change to all product pages at once reaches far more visitors than a change to one product.
4. Qualitative testing. Five users trying version A and version B tell you which one is clearer. Not a percentage, but a strong signal for usability changes.
5. Test in ads or email first. Headlines and offers can often be tested in ad creatives or email subject lines, which get more volume, before you put the winner on your page. See the courses Paid advertising and Email marketing and automation.
I want to test this hypothesis: [paste]. My primary metric is [metric] with a baseline of [rate] on [page], which gets [number] visitors a day. Calculate the sample size per variant for relative lifts of 10%, 20%, 30% and 40% at 5% significance and 80% power, show the formula and each calculation, and the number of days each would take at my traffic. Then recommend: an A/B test (with duration and stop rule), a before/after comparison (with a control), or a qualitative test, and explain why.
Take your number one hypothesis. Calculate the sample size and duration for a realistic MDE. Choose the method (A/B test, before/after with control, or user test) and write the test plan: hypothesis, primary metric, guardrail, sample size, duration, decision rule, start date. Do not start until the plan is written down.
This course is general information, not personal legal, tax or financial advice. Rules, amounts and dates change: check the official source for your country before you act.