Guide · A/B testing

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.

Worked example

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.

Six steps of an A/B test in order: write a hypothesis, check traffic, set up, track, read the result, then log it. Step 2 is the gate.
The six steps of this guide. Step 2 is the gate: a test that needs more than two months should be changed before it starts.

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.

Step 1

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].
Worked example

“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.”

Step 2

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.

Worked example

4.0% today, a 15% lift to detect, 1,200 visitors a day, 95% confidence and 80% power:

17,943visitors per version
35,886visitors in total
30 daysto reach significance

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.

Get a free Traffic Scan →
Step 3

Set up the test

  1. Duplicate the current version as your control, so both start from the same base
  2. Add one variant and change only the element your hypothesis names2
  3. Split traffic 50/50, which reaches significance fastest
  4. Pick one primary metric, or the closest one your tool can track1
  5. Launch and leave copy, design and audience untouched until the date you calculated
Step 4

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

Step 5

Read the result

  1. Did the metric move in the direction your hypothesis predicted?
  2. Is the lift big enough to matter, compared with the effort to roll it out?
  3. Did it reach the confidence level you set before the test?
Worked example, 30 days later

18,000 visitors per version. The control converted 720 (4.00%), the variant 820 (4.56%).

+13.9%uplift
99.1%confidence
p = 0.009p-value

The lift is a little below the 15% the team hoped for, and it is significant, so they roll it out.

Bar chart of the worked example: the control converted 4.00% of 18,000 visitors and the variant 4.56%, with bars starting at zero.
Worked example from this page: 720 orders from 18,000 control visitors (4.00%) and 820 from 18,000 variant visitors (4.56%). Bars start at zero.
You seeDo this
Uplift, significantRoll outShip the variant.
Drop, significantKeep controlThe change hurts. Note why.
Close to the lineExtendRun to the planned sample if you can.
Far from the lineMove onNo real difference. Try a bolder idea.
Significant uplift: roll out. Significant drop: keep control. Not significant: extend if close to the line, otherwise move on.
The four outcomes from the table above, as a decision path. Check significance first, then the direction of the lift.

To check whether a result is significant, use the significance calculator.

Step 6

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

Free A/B testing calculators →

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.

Get a free Traffic Scan →

Frequently asked questions

What is the difference between a one-sided and a two-sided test?
A two-sided test checks if the variant is better or worse than the control. A one-sided test only checks if it is better. One-sided needs about 20% fewer visitors, but it can't confirm that a change hurts, so two-sided is the safer default for most tests.
Can I A/B test with low traffic?
Yes, if you test bigger changes or a metric with more volume. Clicks and add-to-carts happen far more often than orders, so they reach significance sooner. If a test would need more than two months, don't run it as planned.
How many versions can I test at once?
Two is best for most stores. Each extra version adds a full share of traffic to the total and raises the risk of a lucky winner. With three or more, use 99% confidence.
What is the difference between A/B and multivariate testing?
An A/B test compares whole versions that differ in one thing. A multivariate test changes several elements at once and measures every combination, which needs many times more traffic. Most e-commerce sites should stick to A/B tests.
Should traffic always be split 50/50?
For a standard test, yes. An even split reaches significance fastest. Only shift the split, say 80/20, if the new version carries real risk and you want to limit exposure, and accept that the test will take longer.
How long should an A/B test run?
Until it reaches the sample size you calculated before starting, in whole weeks, and never less than seven days. Use the duration calculator to get the number of days for your traffic.

Sources

  1. Klaviyo Help Center, How to A/B test an email campaign: setting up a variation, choosing a winning metric and the test size.
  2. 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.
  3. Google Ads Help, Understand your Conversion Lift based on users measurement data: measuring incremental results against a held-back control group.