What is a controlled experiment
Before anything else: what an A/B test actually is, one whole test from start to finish, and why a coin decides who sees what.
Say your team wants to add the words “free returns” to the button on a product page, and everyone is sure it will sell more. How would you find out whether it really does? The most reliable way is a controlled experiment, on the web usually called an A/B test. The whole method fits in one sentence:
Show the current version to some people and the new version to others, at the same time, let chance decide who sees which, and compare what they do.
One page, two versions, a coin
How to read itRead it from the top. Visitors arrive one after another, and for each one a coin decides which version they will see. Below are the two versions, as wireframes rather than real pages. A is the product page as it is today. B is the same page with one difference: under “Add to basket” the button also says “Free returns”. Blue marks what is different, not a new colour; in the real B the button is still black.
Each part of that sentence protects you from a different mistake.
At the same time. Both versions live through the same weeks, with the same season, the same news and the same weather, so none of those can explain a difference between them.
Chance decides. Nobody picks who sees B, not the team and not the visitors themselves, so the two groups end up made of the same kinds of people.
Compare what they do. Even two groups made of the same kinds of people never behave exactly alike, so the comparison has to tell a real difference from luck. Most of this book is about that part.
One test, from start to finish
Here is a whole test in five steps, with the example this book keeps coming back to.
1 · An idea
Someone thinks that saying “free returns” on the button will make more people buy.
2 · Two versions
A is the page as it is today. B is the same page with the two extra words. Both are live at the same time.
3 · A coin for every visitor
Each visitor is given A or B by chance, and keeps that version every time they come back, so nobody sees the page change under them.
4 · Whole weeks
The test runs for a length decided in advance, here two weeks, so that every day of the week is counted the same number of times.
5 · Count, compare, decide
At the end, count how many people bought in each group and compare. Then keep B, drop it, or find out why it did not work.
What gets counted
At the end of a test you count what people did in each group. The simplest thing to count is who bought.
The share of visitors who buy is called the conversion rate, and most examples in this book use it. After two weeks, the test above might look like this:
| A · today | B · new | |
|---|---|---|
| Visitors | 95,000 | 95,000 |
| Bought | 3,800 | 3,990 |
| Conversion rate | 4.00% | 4.20% |
B sold to 190 more people out of 95,000. Was that the two words, or luck? Answering that properly takes most of Part two. The short version is in the next two sections.
Why chance decides who sees what
Look at the picture again. For the comparison to mean anything, the people looking at A and the people looking at B have to be alike, otherwise you are comparing people, not buttons.
And people are very different. Some are loyal customers who buy every month; others arrived five minutes ago from an advert and are only looking. If one group has more of the loyal ones, it buys more whatever button it sees.
Nobody actually tosses a coin. The coin is a way of saying chosen at random: when a visitor arrives, the website picks A or B for them the way a music app shuffles a playlist, in a split second, with an equal chance for each. What matters is what a coin and a shuffle have in common: neither knows anything about the person.
Because the choice knows nothing about anyone, each group ends up with a similar mix: of loyal and new customers, of phones and laptops, of people in a hurry and people browsing, including every difference you never thought to measure. Then, if one group behaves differently, the design is the only systematic reason left.
What goes wrong without the coin, when people who used a feature are compared with people who did not, or this month with the last, is the subject of chapter 1.
Chance never quite goes away
Even with a perfect coin, two groups are never identical. One gets a few more big spenders, the other a few more people who were only looking. So A and B always differ a little, even when the design does nothing. That leftover wobble is what this book calls noise.
The 190 extra buyers in the table could be partly that. Noise is not a flaw of the method; it is the price of using real people. The good news is that its size can be calculated, and it shrinks as the groups grow. Most of the statistics in the following chapters exist to answer one question, and it is the question to ask of every result you will ever see:
Is the difference bigger than the noise?
Chapter 4 builds that calculation step by step; chapter 6 shows how many people it takes; chapter 9 how to read the answer.
One change, or several?
Change one thing per variation.
Look at B above: same page, same button, two extra words. It would have been easy to also make the button wider and paint it blue, but then, if B won or lost, nobody could say which of the three changes did it. A test of several changes at once is still a fair test of the package; it just cannot say which part helped. Chapter 11 covers the ways to test several changes and several variations, and what each costs.
One more thing to keep in mind from the start: one test is one draw. Even a well-run test lets some changes that do nothing come out as wins, so important results earn trust by holding up again (chapter 9).
What an experiment needs
Five things, in the order you meet them when you plan a test. Leave any one out and the result can look convincing and still be wrong.
The chapters that cover them come in a different order, because the book first builds the ideas each step needs. Read on in order; when you plan a real test, chapter 12 puts everything back in the order of a real test, as a checklist.
- A question worth asking. A hypothesis that says why the change should work and what result would prove it wrong. Chapter 12
- One deciding metric, chosen before. So the result cannot be picked after the fact from whichever number looks best. Chapter 5
- A fair split. A coin toss per person, and a check that the groups came out the size the coin intended. Chapter 8
- Enough people, for long enough. Enough people for the noise to be smaller than the effect you hope for, over whole weeks so every kind of day is included. Chapter 6
- Patience at the end. Read the result when the planned time is up, or only at looks planned in advance. Chapter 7
The words, in one place
Six words come up on every page of this book. Here they are together, so you can come back to them.
- Control, or A
- The version people see today. Everything is measured against it.
- Treatment, variant, or B
- The new version. There can be more than one, B, C, D, and the test is then sometimes called A/B/n.
- Randomisation
- Deciding by chance who sees which version, like a coin toss for every visitor.
- Metric
- The behaviour you count to decide: bookings, sign-ups, revenue per visitor.
- Noise
- The difference between groups that chance alone produces, even when the change does nothing.
- Bias
- A difference that is not chance and does not shrink with more people, such as a different season or different kinds of people in the two groups. Randomisation removes it.
Every other term in the book is in the glossary, with the other names you will meet for it. The method has other names too. Medicine calls it a randomised controlled trial and has used it since the middle of the twentieth century. Online it is a split test, a bucket test, an online controlled experiment. The idea is identical.
What we’ve learned
- An A/B test shows two versions at the same time to people split by chance, and compares what they do.
- Each visitor gets one version, by a coin toss, and keeps it for the whole test.
- The conversion rate is the share of visitors who buy; a test compares it between the two groups.
- The coin toss makes the groups alike in every way, measured or not, so the change is the only systematic difference left.
- Two groups always differ a little by chance; that is noise, and its size can be calculated.
- Change one thing per variation, or know that you are testing a package.
- No single test proves anything. Important results earn trust by holding up again.
Sources
- Kohavi, R., Tang, D. and Xu, Y. (2020). Trustworthy Online Controlled Experiments. Cambridge University Press. Chapters 1 and 2, terminology and the case for controlled experiments.
- Kohavi, R. et al. (2009). Controlled experiments on the web: survey and practical guide. Data Mining and Knowledge Discovery 18. The case for controlled experiments and their pitfalls.
- McFarland, C. (2012). Experiment!. New Riders.