Metrics and experiments
Two dashboards say opposite things about the same launch. Learn to choose metrics and guardrails, run a fair A/B test, size it, and read the result without fooling yourself.
The lesson in text
Click a paragraph to hear it.01Two dashboards, two answers
Monday morning. A week ago, StayHub launched a new one-page checkout in its Android app, in Spain and Portugal. Maya, the product manager, opens her dashboard: bookings per checkout visitor went from 4.0% to 4.3%. It worked.
Omar opens his. Cancellations within seven days went from 6.0% to 7.5%, the same week. Something's wrong with it.
Same launch, two dashboards, two answers. And Lina adds one detail: that week was also a holiday weekend, with a marketing campaign running.
In this lesson, you'll learn to get an answer that only the checkout could have caused: what to measure, how to run a fair test, how many guests you need, and how to read the result without fooling yourself.
02Decide what you measure first
Start with the word metric: a number you track to know if things are going well. Here, the main one is conversion: out of every hundred guests who reach the checkout, how many book. Today, four.
But one number can mislead on its own. A checkout that rushes guests might raise bookings, and raise cancellations even more. So you also pick guardrails: numbers that must not get worse. Cancellations, payment errors, support contacts, page speed.
Think of a trial for a new medicine. Doctors measure whether patients get better, and they also watch for side effects. The cure is the main metric. The side effects are the guardrails.
| Metric | Role | Before the test |
|---|---|---|
| Bookings per checkout visitor (conversion) | Primary: the cure | 4.0% |
| Cancellations within 7 days | Guardrail: a side effect | must not rise |
| Payment errors | Guardrail | must not rise |
| Support contacts per booking | Guardrail | must not rise |
| Page speed (slowest 5% of loads) | Guardrail | must not get slower |
And you write all of this down before anyone looks at the data. Pick your metric afterwards, and among twenty numbers, you'll always find one that went up.
03Before and after can't tell you why
Back to the two dashboards. Both compare the week before the launch with the week after. That's a before-and-after comparison, and it has a big blind spot.
In that one week, four things changed: the new checkout, a holiday weekend, a marketing campaign, and the normal ups and downs of any week. All four are mixed into the same numbers.
The holiday alone could explain both dashboards. Holiday guests book more, and they cancel more. The checkout might have helped, done nothing, or even hurt, hidden behind the campaign.
- · the new checkout
- · a holiday weekend
- · a marketing campaign
- · normal week-to-week ups and downs
- · holiday: both groups
- · campaign: both groups
- · luck: measured by the p-value and the interval
It's like a patient who says: I took the pill, and I felt better. Maybe it was the pill. Maybe it was the weekend off. A story like that can't separate the two. A real trial can.
04A fair test
A medical trial gives the pill to a random half of the patients, and a placebo, a fake pill, to the other half, at the same time. Whatever else happens that month happens to both groups.
Software does the same, and it's called an A/B test. Guests are split at random: half see the old checkout, version A, and half see the new one, version B, during the same weeks.
Because the split is random, neither group gets more holiday guests or more campaign clicks. The holiday hits both equally. So the difference left between A and B comes from the checkout, plus some luck we'll measure.
Two details keep it fair. The same guest always sees the same version, on every visit. And you only count guests who actually reached the checkout.
Before trusting any result, check the split itself. If you asked for half and half and got 51 to 49 on a hundred thousand guests, that's not luck. Something in the plumbing is broken.
05How many guests you need
Now, luck. A trial with ten patients proves nothing: three might get better by chance. Small groups differ by pure luck. So the question is how many guests you need before luck stops mattering.
First you decide the smallest change worth finding. Here: from 4.0% to 4.4%, four extra bookings for every thousand visitors. That's the minimum detectable effect.
A rule of thumb gives the size of each group: sixteen, times the conversion rate, times one minus the rate, divided by the effect squared. Here, about 38,400 guests per group. That catches a real effect of that size about eight times in ten.
n per group ≈ 16 × p × (1 − p) ÷ effect²p = conversion today= 16 × 0.04 × 0.96 ÷ 0.004²4.0%, and an effect of +0.4 points≈ 38,400 guests per group4,000 visitors a day ÷ 2 = 2,000 per group a day38,400 ÷ 2,000 ≈ 19 days → 3 full weeks| Smallest effect worth finding | Guests per group | At 2,000 a day |
|---|---|---|
| +0.8 points (4.0% → 4.8%) | 9,600 | 5 days (run a full week) |
| +0.4 points (4.0% → 4.4%) | 38,400 | 19 days (run 3 weeks) |
| +0.2 points (4.0% → 4.2%) | 153,600 | 77 days (11 weeks) |
Notice the square. Want to detect an effect half as big? You need four times as many guests. Small effects are expensive to see.
This checkout gets about 4,000 visitors a day, so 2,000 per group. That's about nineteen days. You round up to three full weeks, so every day of the week counts equally, and you write the end date down.
06Reading the result
Three weeks later. Version A: 1,680 bookings from 42,000 guests, 4.0%. Version B: 1,848 from 42,000, 4.4%. B is ahead by 0.4 points. But is that the checkout, or luck?
That's what the p-value answers. It asks: if the new checkout changed nothing at all, how often would luck alone produce a gap this big? Here, p is about 0.004: four times in a thousand. Luck is a poor explanation.
| Version | Bookings | Guests | Conversion |
|---|---|---|---|
| A: old checkout | 1,680 | 42,000 | 4.0% |
| B: one-page checkout | 1,848 | 42,000 | 4.4% |
| What it is | What it is not |
|---|---|
| p ≈ 0.004: if the checkout changed nothing, luck would give a gap this big about 4 times in 1,000 | Not "B is 99.6% likely to be better" |
| The interval: the range of true effects that fit the data | Not a guarantee; and "significant" doesn't mean "big" |
Be careful with what it doesn't say. A p of 0.004 doesn't mean B is 99.6% likely to be better. It only measures how surprising the gap would be if nothing had changed.
The more useful number is the confidence interval: the range of true effects that fit the data. Here, from about +0.13 to +0.67 points. The whole range is above zero, and it includes the 0.4 you said would matter.
And the guardrails? Cancellations: 6.1% in A, 6.2% in B, no real difference. So Omar's jump in launch week came from the holiday, not the checkout. Decision: ship B, and keep watching cancellations for a month, because they come in late.
07The win that wasn't
Now the trap. Last spring, StayHub tested a "pay at hotel" button. Someone checked the results every morning. On day three, p was 0.04, under the usual line of 0.05. They stopped the test and shipped the button.
Two months later, conversion was exactly where it had been before. The win was luck.
Here's why. The 0.05 line means one false win in twenty, but only if you look once, at the end you planned. Every extra look is another chance for luck to cross the line. Look every day for three weeks, stop at the first good number, and about one test in four declares a win that isn't there.
| How you read the test | Chance of a false win when nothing changed |
|---|---|
| Once, on the planned end date | 1 in 20 (5%) |
| Every day for three weeks, stopping at the first p under 0.05 | about 1 in 4 (25%) |
It's like stopping a medical trial on the first morning the pill looks good. The fix: set the size and the end date before you start, and look once. If you really must watch along the way, use a method built for it, called a sequential test. And keep the p-value off the dashboard until the end.
08When you can't test
A/B tests need traffic. Maya wanted to test the payout page redesign too. But to see a ten percent drop in tickets, you'd need about nine thousand hotels in each group, and StayHub has about ten thousand in total.
So the team shipped it behind a feature flag, so it can be switched off, compared tickets with the same season last year, and watched five partners use the page. Weaker evidence, honestly labelled, is still a decision you can defend.
| Approach | Fits when | Its limit |
|---|---|---|
| A/B test | Lots of traffic, a measurable outcome, a reversible change (the checkout: 4,000 visitors a day) | Needs enough users and weeks of time |
| Ship behind a flag and monitor | Too few users to split (the payout page: ~10,000 hotels, ~9,000 needed per group) | Before/after is weaker: seasons and other changes mix in |
| Watch a few people use it | You need to know why, not how much | Five sessions can't measure the size of an effect |
09Your job as lead
With Claude Code, an experiment is a few prompts away, and so are its mistakes. Before it builds anything, write down the metric, the guardrails, the smallest effect, the size and the end date.
Then ask it to show you two places: where each guest's version is decided, so a guest always gets the same one, and where it counts a guest as having seen the checkout. Ask for an analysis that checks the split first, and refuses to report if it's off.
Watch for red flags. A dashboard with a p-value every day. A message on day three: it's significant, shall I ship it? Or a sentence like "97% chance B is better". Your answer: wait for the end date, then read the interval and every guardrail.
Let's recap. Decide the metric and the guardrails first. Before and after mixes everything together; a random split at the same time isolates one change. Size the test before it starts, look once, and read the interval, not just the p-value. Next lesson: StayHub runs in a single region. Karim wants a second one by summer. Omar wants fewer moving parts. Both have a point.
Check yourself
0/10 answered1Conversion went from 4.0% to 4.3% the week after a launch, during a holiday weekend and a marketing campaign. What can you conclude about the launch?
2Why pick guardrail metrics on top of conversion?
3Why does a random split at the same time remove the holiday effect?
4Claude Code's test code picks the version again on every page view. What's the problem?
5You want to detect an effect half as big as planned. How many guests do you need?
6The checkout gets 4,000 visitors a day, split 50/50, and you need 38,400 per group. How long do you run the test?
7The test reports p ≈ 0.004. What does that mean?
8On day 3 of a planned 21, Claude Code writes: "B converts 4.6% vs 4.0%, p = 0.04, significant. Shall I ship it to everyone?" What do you answer?
9You asked for a 50/50 split. After 100,000 guests, the groups are 51,000 and 49,000. What do you do?
10After 21 days: B is ahead by 0.4 points, interval +0.13 to +0.67, and every guardrail is flat. What's the decision?
Save your progress — create a free account
Free. No card. Your finished lessons follow you to any device, and you can ask questions in the community.
Create my free accountEvery lesson is free while we build. Lock in €9/month for later.
The first 100 members keep the founding price for as long as they stay. Reserving is free: no card, nothing is charged.
See the founding offer