Two designers disagree about a button. One wants it green and at the top. The other wants it where it is. The meeting ends, as these meetings do, with the most senior person's preference.

An A/B test offers a better way to end it. Show half your visitors one version and half the other, and count which gets more people to do the thing you care about. It is a controlled experiment, the same idea as a clinical trial, and when done properly it is hard to argue with.

The difficulty is the phrase "done properly". Here are the five ways these tests most often go wrong, in the order people usually meet them.

1. Deciding what to measure afterwards

Run a test, and then look at clicks, sign-ups, time on page, scroll depth and bounce rate, and one of them will show a difference. That is not a discovery. With five measures and the usual threshold for significance, the chance that at least one moves by luck alone is over one in five.

Choose one primary measure before you begin and write it down. It should be the thing the page exists for: completed bookings, not clicks on the button. You can look at the others, but as hints for the next test, not as results of this one.

2. Stopping when it looks good

This is the most tempting mistake and the most damaging.

You start the test on Monday. By Wednesday version B is ahead and the dashboard says "95% confident". You stop and ship it.

The trouble is that results wobble, especially early, when the numbers are small. If you check every day and stop the first time the difference crosses the line, you will often catch it at a lucky moment. Run a test in which the two versions are identical and peek daily, and you will "find" a winner far more often than the five per cent you thought you were risking.

The remedy is boring. Decide the sample size in advance and do not draw a conclusion before you reach it.

3. Not having enough visitors

How big does the sample need to be? It depends on two things: how often people currently do the thing, and how small an improvement you want to be able to detect.

A rough illustration. Suppose three in every hundred visitors book. To reliably detect an improvement to three and a half in a hundred, you need on the order of twenty thousand visitors in each version. To detect a jump to six in a hundred, you need only about a thousand each.

The lesson is uncomfortable for small sites. Subtle changes need enormous traffic. If you get two thousand visitors a month, you can only ever detect large effects, so test bold changes, such as a different page structure, and do not bother with the shade of a button.

Free sample-size calculators will do the arithmetic. Use one before you build anything.

4. Unequal groups

The two groups must differ only in the version they see. That means visitors are assigned at random, and a returning visitor keeps seeing the same version.

It also means running both versions over the same period. Version A last week against version B this week is not a test; last week had a holiday in it. And run for whole weeks, because weekend visitors behave differently from weekday ones, and a test that runs Monday to Thursday has measured only half your audience.

A check that catches many faults: the groups should be about the same size. If you asked for a fifty-fifty split and got fifty-five to forty-five, something in the setup is broken, and the result cannot be trusted whatever it says.

5. Changing too much, or too little

Change ten things at once and a win tells you nothing about which mattered. Change one tiny thing and you will need traffic you do not have.

The useful middle is one change that embodies a single idea. "People do not see the price until too late" is an idea; moving the price above the fold is the change that tests it. Whether it wins or loses, you learn something about your visitors, which is worth more than the percentage.

Reading the result

Suppose you avoided all five traps and version B won, with a result your tool calls significant. Three more things to keep in mind.

Significant does not mean large. With enough traffic, a difference of a twentieth of a percentage point becomes "significant". Ask how big the effect is, and look at the range the tool gives round it. "Between one and nine per cent better" is a truer statement than "five per cent better".

The first weeks flatter novelty. Regular visitors notice a change and poke at it. Check again a month later.

A test tells you what, not why. For why, you still need to watch people. Five visitors thinking aloud as they use a page will explain a result that fifty thousand anonymous visitors only reported.

When not to test

Testing is a tool for choosing between working options. It is the wrong tool in several common situations.

If something is plainly broken, fix it. You do not need an experiment to justify making the text readable.

If you have little traffic, a test will take months and decide nothing. Spend an afternoon watching five people instead.

And if the question is about what the brand should be, no experiment will answer it. A test can tell you which headline gets more clicks this month. It cannot tell you what you want to be known for, and optimising one page at a time towards whatever gets clicked is how a design loses its character.

The two designers and their button, then. The honest outcome of a well-run test is quite often "no detectable difference", which is itself a result. It means the argument was not worth having, and the hour is better spent on something visitors would notice.