Ab Testing Data Science
Ab testing data science - Master A/B Testing Data Science: learn sample sizes, significance and randomisation so you can trust results before shipping any

The UK e-commerce market's add-to-cart rate ran between 9.5% and 10.0% in 2025, according to ECDB's UK market data. Fewer than one session in ten produces even that weak signal, and far fewer end in a paid order.
That is the honest starting point for ab testing data science. A 20% relative lift on a 9.5% baseline lands at roughly 11.4%, which is two extra add-to-carts per hundred sessions rather than a transformation. At that scale, the p-value is the easy part of the job.
The hard parts are the ones nobody demoes: working out how much traffic a credible answer needs, choosing a metric that reflects money rather than motion, and reading a wide interval when the sample is thin and the mobile numbers are worse than the desktop ones.
How Data Science Fits Into Every Stage of an A/B Test
In 2024, 87% of UK marketers said experimentation was important to achieving their business goals, according to Optimizely's UK experimentation study as reported by DecisionMarketing. Almost everyone agrees the activity matters. The argument starts one step later, over what a finished test said.
Here is the sequence the statistics serve, from the question to the decision.

A test has two halves. The recipe is the hypothesis: the change, the audience it applies to, and the reason you expect it to move a specific number. The thermometer is the statistics: the sample size, the comparison, the interval. A cook who never checks the temperature isn't cooking, they're hoping. A marketer who ships a variant because the chart line went up is doing the same thing with more expensive ingredients.
Six stages, six places to trip
- Question and metric. Data science forces one primary outcome and the arithmetic that will judge it. The usual mistake is three "primary" metrics, which guarantees you'll report whichever one won.
- Sample size. This turns a wish into a number of visitors per variant and a run date. Skipping it is how tests get stopped on a Tuesday because someone got impatient.
- Randomisation. Unbiased assignment is the whole engine, and it has to happen before the visitor sees anything. Assignment applied after exposure measures the effect of being exposed, not the effect of the change.
- Collection without peeking. A fixed end date protects the result. Daily dashboard checks followed by early stops inflate false winners dramatically.
- Analysis. Significance plus an interval, reported together. The common failure is a p-value on its own, which tells nobody how big the effect might be.
- Decision. Ship, keep testing or stop, written before the test opens. Most bad calls happen when the rule set is invented after the result arrives.
The thermometer rule: a recipe tells you what to cook, and a thermometer tells you whether it reached temperature. A test with no pre-planned sample size is cooking with the oven door open.
None of that survives messy instrumentation. If order events double-count or a variant's pageviews vanish after a deploy, the analysis inherits the damage, so familiarise yourself with data cleaning best practices before you trust any number the tool prints.
Before you open the test editor, write your next experiment onto these six stages as a single page. If a stage has no answer, that's the stage that will cost you the result.
Picking Metrics That Measure Revenue, Not Just Clicks
Say a homewares store tests a new add-to-cart button. Conversion rises from 3.0% to 3.3%, a 10% relative lift, and the team calls it a winner. Then someone checks order value, which slipped from £68 to £61. Revenue per visitor tells the fuller story: 0.030 × £68 is £2.04, while 0.033 × £61 is £2.01. The statistically significant winner lost money.
That is the trap with click-level metrics. They behave like a shop doorbell: useful for knowing that someone came in, useless for knowing what left the till. A metric earns a place in the decision only when it connects the change to commercial value, or protects the test from a hidden trade.
Metric What it tells you Watch-out Conversion rate Share of visitors who complete the goal Can rise while order value falls Add-to-cart rate Early purchase intent Diagnostic only, not a success metric Checkout abandonment Share of baskets not completed; about 74% of UK baskets in Q4 2024, according to the Retail Institute's checkout abandonment study at Leeds Beckett Needs confidence intervals and random assignment before checkout Average order value Size of each order Noisy; needs larger samples to be reliable Revenue per visitor Commercial value of each variant Skewed by large orders; use a variance-aware testWhere the money actually leaks
The same UK retail finding makes checkout a practical place to look: approximately 74% of baskets created in the final quarter of 2024 did not become completed orders, as reported in the Retail Institute's checkout abandonment study at Leeds Beckett. That is where experiments earn their keep. Delivery information, payment presentation, trust signals and cart recovery all sit between the basket and the order.
Treat the checkout test as a causal experiment with randomisation before the experience, then report order conversion with an interval rather than a single decimal. A conversion lift is credible only when the metric was defined before the test opened and the visitors reaching it were assigned fairly.
Revenue needs more care than conversion because it is a ratio of sums, not a tidy symmetric value. One £400 order in a variant with 500 visitors can swing the average enough to change the conclusion. That is why revenue per variant is compared with Welch's t-test for unequal variance. Otter measures conversion rate, average order value and revenue per visitor side by side for exactly this reason.
Guardrail rule: write down the metrics that must not get worse, order value and returns among them, before the test opens. A lift in conversion that comes with a fall in basket size is a trade, not a win, and you should only accept it knowingly.
If the model runs on repeat purchases rather than one-off baskets, the decisive number sits further out than the first order. Tracking recurring revenue and retention alongside test results stops you optimising a first purchase that never comes back.
Work Out Sample Size Before You Split Traffic
Four inputs decide the number, and all four are yours to set.
- Baseline conversion rate. Measure it on the same traffic you'll test on, over the last 30 days, not from a dashboard mixing paid and organic.
- The smallest relative lift worth acting on. A 20% lift on a checkout page is a different decision from a 20% lift on a footer link.
- The significance level. 95% two-sided is the normal threshold, which accepts a false positive about once in twenty comparisons.
- Power. 80% is the usual target, meaning you accept a one-in-five chance of missing a real effect of the size you specified.
The table below assumes a two-sided test, 95% significance, 80% power and a fixed end date.
Baseline conversion Relative lift to detect Visitors per variant (approx.) 2% 20% (2% to 2.4%) about 21,000 5% 10% (5% to 5.5%) about 31,000 5% 20% (5% to 6%) about 8,200 10% 10% (10% to 11%) about 15,000 10% 20% (10% to 12%) about 3,800What the rows cost in orders, not visitors
Read across the 5% rows: a 10% lift needs about 31,000 visitors per variant and a 20% lift needs about 8,200. Halving the lift roughly quadruples the traffic, because the effect you're hunting becomes half as wide and the sample grows with the square of that change.
The statistics don't count visitors, they count events. 8,200 visitors converting at 6% is about 490 orders per variant. The 5% to 5.5% row needs 31,000 visitors to produce about 1,700 orders, three and a half times as many purchases for a smaller claim. A 2% baseline reaching 2.4% at 21,000 visitors gives roughly 500 orders, which is why low-baseline stores burn months to say anything at all.
A/B testing suits a site with enough traffic to detect the lift it cares about, typically a few thousand conversions per variant. If yours can't get there, you're not measuring, you're watching.
When the traffic isn't there
You have two honest options, and inventing a third one is how teams end up with unreadable results. Test a bigger change, so the effect you're chasing is wide enough to see at your volume, or accept a longer run and plan the calendar around it. Dropping the threshold, adding variants and peeking at the dashboard all feel like progress and all raise your false-positive rate.
Temptation peaks around week three, when the line wobbles. Sensible stopping rules for low-traffic tests are what keep a thin sample from producing a confident-sounding answer.
The full derivation behind these figures, including the formula and the power calculation, is set out in our guide to A/B testing sample size. Our own habit is simple: run the sample size calculator before launching any test, and write the required visitor count into the test document next to the hypothesis. If you can't fill that line in, the test isn't ready to open.
Why Random Assignment Makes Results Trustworthy
Random assignment works like shuffling a deck before dealing. If the shuffle is fair, age, device, loyalty, browsing habits and every other visible or invisible trait should be spread across variants by chance. That is why the 1948 streptomycin trial matters: it combined random allocation, a treatment-control comparison, central data collection and review across several medical centres, as the Medical Research Council trial history records. The same logic applies to a website experiment, where the goal is to make the only systematic difference between groups the change being tested.

Early trials that let staff predict the next allocation produced imbalanced groups. The problem was predictable assignment: if a coordinator knows who gets the next treatment, they can consciously or accidentally place different kinds of participants into different arms. Selection bias then hides inside the final comparison. A website version of that mistake is letting returning shoppers see version A and new visitors see version B. The result looks like a headline test, but it is really new customers against returning ones.
The practical rule is allocation concealment: assignment stays unknown until the visitor is eligible and about to be exposed. For web tests, three checks keep that promise.
- Random. Every eligible visitor has the same chance of landing in each variant.
- Sticky. The same visitor sees the same variant on every return visit, via a cookie or server-side assignment.
- Before exposure. Assignment happens before the visitor sees the change, never after a click is logged.
The check that catches broken assignment
Sample ratio mismatch is the fastest diagnostic. If a 50/50 design records 52/48 across 50,000 visitors, you're 1,000 visitors off expectation on each side. The standard deviation of that split is about 112, so a gap of 1,000 is roughly nine standard deviations from plan. Assignment or tracking is broken, and no p-value from that data means anything.
This is also why significance cannot carry the decision alone. A variant can show a significant click lift while revenue falls, because randomisation protects the comparison only when assignment and measurement are sound. Check the split first, then interpret the outcome.
One privacy note worth raising early with your team: the ICO guidance on storage and access technologies says A/B testing may fall within the statistical-purposes exception when it compares aggregate interactions with different website versions, provided the data cannot identify individuals and appropriate technical and organisational measures are in place. That depends on purpose, transparency and an objection route, so confirm the design rather than assuming it.
Ask four questions of any running test: is the split random, is it sticky, does it start before exposure, and does the observed ratio match the design. Any "no" is a reason to pause.
Reading Significance and Choosing a Test Method
A p-value answers one question only: if the two variants were identical, how often would chance alone produce a gap this big? A p-value of 0.03 means about 3 in 100.

At a 95% threshold you're accepting a 1 in 20 false-positive rate for a single comparison. That risk compounds fast when the same test gets checked repeatedly: five looks at the dashboard push the chance of at least one spurious win to roughly 23%, which is 1 minus 0.95 raised to the fifth power. A team that checks twice a day for three weeks is running a very different test from the one it designed.
What the interval is telling you
The confidence interval is the range of lifts consistent with your data. A variant that beats control on the point estimate but carries an interval from 0.1% to 6% is not decision-ready, because the plausible truth still includes almost nothing. Wide intervals come from small samples and noisy metrics, and no amount of staring at them narrows them.
If the p-value still feels abstract, this plain explanation of how to read A/B test significance works through the threshold case by case.
Here is the same logic in video form, if you prefer to hear the reasoning rather than read it.
Where UK data makes false winners more likely
UK shoppers browse more than they buy, which leaves purchase data sparse and headline tests vulnerable to false confidence when teams optimise for clicks. Published UK market summaries in the DHL UK e-commerce country report report substantially lower mobile-web conversion than desktop, while some 2025 estimates put overall UK session conversion near 1.7%. At that base rate, a segment that looks like a winner on aggregate can be a loser on mobile, and a significant conversion gain can arrive with lower-value orders or higher returns.
Method How it reports Best when Watch-out Frequentist (fixed horizon) p-value and lift against a 95% threshold The end date and sample size are planned in advance Checking early and stopping at the first win inflates false winners Bayesian Probability that a variant beats control Stakeholders want a direct probability for decisions Priors and decision thresholds must be set before launch Multi-armed bandit Bayesian, with traffic shifting toward leaders The cost of showing the weaker version is high, such as a short promotion Estimates of the true lift are less clean Three or more variants Adjusted significance across comparisons Testing several headlines or layouts at once Each extra variant raises the bar for a real winnerThe choice between the two main reporting styles is a design decision rather than a matter of taste, and the difference between Bayesian and frequentist testing is worth settling before the test opens, not after the numbers land.
Testing three or more variants raises the bar further. Every additional comparison adds false-positive risk, so a four-way test needs an adjusted threshold before anyone declares a winner. Otherwise the best-looking arm of four is often just the luckiest one.
Pre-specify or don't report: the method, the segments you will check and the stopping rule belong in the test document before launch. Anything decided afterwards is a hypothesis, not a result.
Worked Examples From Checkout and Headline Tests
Three hypothetical cases for a UK homewares store, Hearth & Home, running about 3,000 visitors a week. The numbers are illustrative, the arithmetic is not.

Case one, the delivery-date message. A checkout variant adds a dispatch date above the payment button. Abandonment falls, conversion moves from 3.2% to 3.4%, and average order value slides from £72 to £66. Revenue per visitor goes from £2.30 to £2.24, so the financial case is flat at best. Decision: don't ship, keep testing with a variant that protects the basket, perhaps by pairing the date with a free-delivery threshold.
Case two, the homepage headline. The store wants a 20% relative lift on a 5% baseline. That row needs about 8,200 visitors per variant, so 16,400 in total, which at 3,000 visitors a week is roughly 5.5 weeks. Plan six and resist the urge to call it in week two. A 10% lift on the same baseline needs about 31,000 per variant, or 62,000 in total, so about 21 weeks of the store's entire traffic. Decision: test the bigger change, or treat the headline test as a click diagnostic and stop pretending it can settle revenue.
Case three, the platform migration. Moving to a new checkout is irreversible, runs across every visitor at once and is expensive to get wrong. A/B testing is the wrong tool when the change is irreversible and being wrong is expensive. Decision: staged rollout by traffic share, with conversion and abandonment monitored as a pre-launch analysis rather than a randomised claim.
Each case ends on one decision, written down before the next test starts. That is the difference between a programme and a hobby.
Decide Whether to Ship, Keep Testing or Stop
Three rules cover almost every ending.
- Ship when the primary metric reaches significance at the planned sample size, the guardrails held, and the result survives the device and traffic-source checks you named in advance.
- Keep testing when the planned sample hasn't been reached or the interval still includes values too small to act on. Waiting is a decision, not a failure.
- Stop when a guardrail worsens, even if conversion improved. Record why, because a stopped test with a written reason is a lesson and a stopped test without one is folklore.
The five-item checklist for any result
- Primary metric named before launch. If it changed mid-flight, the result is exploratory.
- Planned sample reached. Compare the recorded visitor count against the number you wrote down.
- Interval excludes zero. A wide interval means keep testing, whatever the headline says.
- Guardrails checked. Order value, returns and refunds, not just conversions.
- Segments consistent. Desktop and mobile, direct and paid, new and returning.
Run the checklist in order and don't skip to item three because it's the comfortable one. A single strong segment doesn't outvote the aggregate, and one early peek doesn't reset the clock.
The practical sequence is short. Before launch, calculate the required sample size from your baseline and the smallest lift worth having, then open the test. Afterwards, walk the five items in order and write one sentence stating ship, keep testing or stop, with the number that justified it.
Before your next test, run our free sample size calculator with your baseline and the smallest lift you'd act on, then keep the results page open while the test runs: Otter's executive summary card states in one line whether to ship, keep testing or stop, backed by a significance calculator, duration calculator and a preview tool that checks your goals fire correctly. Otter A/B tracks conversion rate, average order value and revenue per visitor side by side, so a significant winner that loses revenue shows up as exactly that. Start free at Otter A/B, no credit card required, and let the arithmetic run before the cheering starts.
Stop guessing
Ready to start testing?
Set up your first A/B test in under five minutes. No credit card required.
- 14-day free trial
- No credit card required
- Cancel anytime