A/B testing best practices for e-commerce.
A/B testing for e-commerce: how to plan, run and read a test, how long to run it, with a worked example and two free calculators.
What an A/B test is
An A/B test shows half your visitors the current version (the control) and half a new one (the variant) at the same time. Split 50/50, track one metric, and run until you reach the sample size you calculated first. If the variant wins, the one thing that differs is the only likely cause.
Stopping early or changing the test mid-run can make a random gap look like a win.
A skincare store shows 1,200 cart visitors a day. 4.0% of them place an order. The team wants to add a bar to the cart that shows how far the visitor is from free shipping.
Every test follows the same six steps. Step 2 is the gate: if the test needs more than two months, change the plan before you launch.
Why sample size matters
In an example with 20 visitors per version, 2 orders against 3 looks like a +50% lift. With numbers that small, a gap like that appears by chance even when nothing has changed.
Measured on thousands of visitors, the same lift would be a real finding. Work out how many visitors your test needs before you start, and let it run until it has them.
Write a hypothesis
Write down what you expect to happen and why. This makes you choose one metric and gives you something clear to judge the result against.
If we [change], then [metric] will [move], because [reason].
“If we show a free-shipping progress bar in the cart, the order rate will rise by 15%, because visitors close to the threshold will add one more item instead of leaving.”
Check you have enough traffic
Before you set anything up, calculate how long the test needs. You need three numbers:
- your current conversion rate
- the smallest lift that would be worth acting on
- how many visitors a day will see the test
If the answer is more than two months, change the plan. Over that long, seasons, campaigns and site changes start to affect the result.
4.0% today, a 15% lift to detect, 1,200 visitors a day, 95% confidence and 80% power:
If you don't have enough traffic, test a metric higher in the funnel. More visitors click than buy, so a click or add-to-cart test reaches significance much faster and still shows whether the funnel improves.
- Views
- Clicks
- Add-to-carts
- Orders
Before launching, check that the test fits in under two months, that the lift you need is realistic, and that no other test is running on the same visitors.
To work out how many days the test needs, use the duration calculator.
See where your website loses revenue.
Set up the test
- Duplicate the current version as your control, so both start from the same base
- Add one variant and change only the element your hypothesis names2
- Split traffic 50/50, which reaches significance fastest
- Pick one primary metric, or the closest one your tool can track1
- Launch and leave copy, design and audience untouched until the date you calculated
Track the test
Your testing tool tells you whether the variant won on the primary metric.
Your analytics tool tells you what the win is worth in revenue and order value, and whether the lift holds further down the funnel. Check both before you decide. For email and SMS, a held-back control group shows whether those messages add sales at all.3
Read the result
- Did the metric move in the direction your hypothesis predicted?
- Is the lift big enough to matter, compared with the effort to roll it out?
- Did it reach the confidence level you set before the test?
18,000 visitors per version. The control converted 720 (4.00%), the variant 820 (4.56%).
The lift is a little below the 15% the team hoped for, and it is significant, so they roll it out.
| You see | Do this |
|---|---|
| Uplift, significant | Roll outShip the variant. |
| Drop, significant | Keep controlThe change hurts. Note why. |
| Close to the line | ExtendRun to the planned sample if you can. |
| Far from the line | Move onNo real difference. Try a bolder idea. |
To check whether a result is significant, use the significance calculator.
After the test
- Log the hypothesis, dates, sample size, result and what you learned, including for tests that lost
- Apply what worked to similar pages, popups and emails
- Rate your next ideas on impact, confidence and effort, and run the highest score first
Common mistakes
- Stopping the test early because the first days look good, when results usually move a lot before they settle
- Editing the versions or the audience while the test is running
- Running the test during a sale or holiday and treating the result as normal
- Changing several things at once, so you can't tell which one made the difference
- Rolling out a lift that is real but too small to be worth the work
What to test
The same method works on every channel. Good places to start are pages with a lot of traffic and changes that are cheap to make.
Onsite messages
- Headline and offer
- Button copy
- Design and position
- Number of form fields
- Single vs multi-step forms
Email and SMS
- Subject line and preview
- Send time and delay
- Offer vs no offer
- Flow length
- Product blocks and layout
When and to whom
- Trigger: delay, scroll, exit intent
- New vs returning visitors
- Traffic source and device
- Frequency caps and cooldowns
- Hiding after purchase
For flow length, see how many emails an abandoned cart flow needs. For second orders, start from your repeat purchase rate.
Discover your website’s 3 biggest gaps for free.
Frequently asked questions
What is the difference between a one-sided and a two-sided test?
Can I A/B test with low traffic?
How many versions can I test at once?
What is the difference between A/B and multivariate testing?
Should traffic always be split 50/50?
How long should an A/B test run?
Sources
- Klaviyo Help Center, How to A/B test an email campaign: setting up a variation, choosing a winning metric and the test size.
- Klaviyo Help Center, How to A/B test a flow email: testing one element at a time in a flow email, including subject lines and discounts.
- Google Ads Help, Understand your Conversion Lift based on users measurement data: measuring incremental results against a held-back control group.