Sub topic 15
Testing One Change at a Time
This chapter assumes you know the visitor-to-lead funnel, how to calculate conversion rate, and the difference between lead volume and lead quality. You should also be comfortable reading a basic HTML form and short Python scripts. Earlier chapters covered the offer, headline, call to action, page structure and form. This one covers how to improve them with evidence instead of opinion.
Why test at all
Every choice on a landing page is a guess about what a visitor will respond to. You can improve the guesses by reading research and copying good examples, but your audience is specific. A headline that works for one product can fail for another.
An A/B test shows two versions of a page to different visitors at the same time and compares how many in each group take the action you care about. Version A is the control, which is the current page. Version B is the variant, which is the page with one change.
Testing gives you three things:
- A way to settle disagreements with data.
- Protection against changes that look better but convert worse.
- A record of what you learned, so the next test starts from knowledge.
Change one variable
The central rule is to change one thing between control and variant. If you change the headline, the button text and the form length together, and the variant wins, you do not know which change helped. One of them might have helped a lot while another hurt.
A variable is any single element you decide to alter. Good candidates come from earlier chapters:
| Variable | Control | Variant |
|---|---|---|
| Headline | "Email checklists" | "Cut your onboarding time in half" |
| Call to action | "Submit" | "Get the free checklist" |
| Form length | Name, email, company, phone | Email only |
| Offer | Checklist | Template pack |
| Page section | Testimonials below the form | Testimonials above the form |
Wording changes within one element still count as one variable. Rewriting a headline completely is one test, because you are testing the headline as a whole.
Write a hypothesis first
Before building a variant, write down what you expect and why. A usable hypothesis has three parts: the change, the expected effect, and the reason.
Example: "Shortening the form from four fields to one will raise the visit-to-lead rate, because fewer fields mean less effort. Lead quality may fall, so we will also track the lead-to-customer rate."
The hypothesis forces you to name the metric before you see results. It also stops you from searching afterward for any number that happens to look good.
Choose metrics before you start
Pick one primary metric and a small number of guardrail metrics.
- Primary metric: the number the test is meant to move, usually visit-to-lead rate.
- Guardrail metrics: numbers that must not get worse, such as lead-to-customer rate, unsubscribe rate, or form error rate.
The guardrail matters because of the trade-off described in the lead quality chapter. A shorter form often brings more leads and weaker ones. The code below compares two form variants on both rates.
def lead_to_customer_rate(customers, leads):
return customers / leads if leads else 0.0
variants = {
"A: short form": {"visitors": 1000, "leads": 60, "customers": 3},
"B: long form": {"visitors": 1000, "leads": 35, "customers": 4},
}
for name, v in variants.items():
visit_to_lead = v["leads"] / v["visitors"]
lead_to_cust = lead_to_customer_rate(v["customers"], v["leads"])
print(f"{name}: {visit_to_lead:.1%} of visitors become leads, {lead_to_cust:.1%} of leads become customers")The output is 6.0% and 5.0% for the short form, then 3.5% and 11.4% for the long form. The short form wins on leads but produces fewer customers (3 against 4) from the same traffic. Whether that matters depends on your costs, such as the cost of following up with each lead. With only 3 and 4 customers, the difference is also too small to trust, which the next sections explain.
Split traffic fairly
A fair test needs three conditions.
- Random assignment. Each visitor is placed in A or B by chance, not by device, location or time of day. Testing tools do this for you.
- Simultaneous running. Run both versions during the same period. If A runs in the first week and B in the second, a holiday, a newsletter or an ad change could explain the difference.
- Consistent experience. A returning visitor should see the same version every time. Tools usually store the assignment in a cookie.
Keep the traffic source in mind. If a campaign sends visitors who already know your brand, the result may not hold for cold traffic from search ads. Message match, covered earlier, still applies to both versions.
How much data is enough
Conversion rates are noisy. If the true rate is 4%, one batch of 100 visitors might give 2 leads and the next 7. A small difference between A and B may be luck.
Two ideas help you judge this.
- Sample size: the number of visitors needed in each group before the result is reliable. Smaller expected differences need larger samples. Detecting a move from 4.0% to 4.4% takes far more traffic than detecting a move from 4.0% to 6.0%.
- Statistical significance: an estimate of how unlikely the observed difference would be if the two versions really performed the same. A common threshold is a p-value under 0.05, meaning a difference this large would appear less than 5% of the time by chance alone.
The script below applies a two-proportion z-test using only the standard library. It tells you whether the gap between two conversion rates is likely to be real.
from math import sqrt, erf
def two_proportion_p_value(leads_a, visitors_a, leads_b, visitors_b):
p_a = leads_a / visitors_a
p_b = leads_b / visitors_b
pooled = (leads_a + leads_b) / (visitors_a + visitors_b)
se = sqrt(pooled * (1 - pooled) * (1 / visitors_a + 1 / visitors_b))
if se == 0:
return 1.0
z = (p_b - p_a) / se
cdf = 0.5 * (1 + erf(abs(z) / sqrt(2)))
return 2 * (1 - cdf)
small = two_proportion_p_value(40, 1000, 52, 1000)
large = two_proportion_p_value(400, 10000, 520, 10000)
print(f"1,000 visitors each: p = {small:.3f}")
print(f"10,000 visitors each: p = {large:.4f}")Both tests show the same rates, 4.0% against 5.2%. With 1,000 visitors per group, the p-value is about 0.20, so the gap could easily be chance. With 10,000 per group, it is far below 0.05. The rates are identical and only the evidence differs.
Decide the stopping rule in advance
The most common testing error is stopping when the numbers look good. Results swing early in a test. If you check every day and stop the first time p dips under 0.05, you will declare winners that are only noise.
Set the rules before launch:
- Calculate the sample size you need, using an online calculator or your testing tool.
- Run for at least one full week, so weekday and weekend behavior are both included. Two weeks is safer for low-traffic pages.
- Do not stop early because one version is ahead.
The test cycle
Testing works as a loop. Each result feeds the next hypothesis.
Reading the result
There are four outcomes, and each is useful.
- Variant wins on the primary metric and guardrails hold. Ship it and record the lift.
- Variant wins on leads but a guardrail drops. Compare the cost of the extra low-quality leads with the value of the extra volume. Do not ship automatically.
- No significant difference. The change did not matter much at this sample size. Keep the simpler version and test something with a larger expected effect.
- Variant loses. You avoided a mistake. Note why you think it lost.
A "flat" result is common. Most tests do not produce winners, so plan for many small tests rather than expecting a big gain from each.
Where to focus first
Tests have a cost in time and traffic, so rank ideas. A simple method scores each idea from 1 to 5 on three questions: how big is the likely effect, how confident are you, and how easy is it to build. Start with high scores.
In general, changes closer to the visitor's decision tend to have larger effects: the offer, the headline and the form. Button color and minor wording usually have small effects and need huge samples to detect.
If your page gets little traffic, say fewer than a few hundred visitors a month, formal A/B tests may never reach a reliable result. In that case, make bold changes, compare before-and-after periods carefully, and gather qualitative input such as short visitor surveys or recorded sessions.
Common errors
| Error | Why it misleads | Fix |
|---|---|---|
| Changing several elements at once | You cannot tell which change caused the result | Test one variable per test |
| Stopping early | Early swings look like wins | Fix the sample size beforehand |
| Running versions in different weeks | Time effects mix with the change | Run A and B simultaneously |
| Watching only lead count | Volume can hide poor quality | Add a lead-to-customer guardrail |
| Testing many metrics and picking the best | Some will look good by chance | Name one primary metric in advance |
| Ignoring segments with tiny samples | Small groups give unstable numbers | Treat segment findings as ideas for new tests |
Keep a test log
Record each test in a simple table: date range, hypothesis, variable, sample sizes, primary result, guardrail result, decision and what you learned. A log prevents repeated tests, helps new team members and shows which kinds of changes move your audience.
Exercise
A landing page converts 3.0% of visitors to leads. A teammate proposes a new headline, a shorter form and a new button label all in one variant. The variant converts at 4.1% after the planned sample. What is wrong with learning from this test, and how would you redesign it?
Show answer
Three elements changed together, so you cannot tell which one caused the lift, or whether one helped while another hurt. Redesign it as separate tests, each changing one variable (headline, form length, button label), with a written hypothesis, a primary metric of visit-to-lead rate, and a lead-to-customer guardrail. Run each to its planned sample size. If traffic is too low for three sequential tests, test the change most likely to have the largest effect first, such as the headline or the form.
Exercise
After three days of a test, version B leads 6.0% to 4.5% with p = 0.03. Your plan called for 8,000 visitors per version and you have 900 each. Should you ship B? Give the reason.
Show answer
No. The planned sample has not been reached, and early results swing widely. Stopping the first time p falls below 0.05 raises the false-positive rate well above 5%. Continue to the planned sample size, covering at least one full week, then check the primary metric and the guardrail metrics.
Exercise
Variant A (short form) gets 6.0% visit-to-lead and 5.0% lead-to-customer. Variant B (long form) gets 3.5% visit-to-lead and 11.4% lead-to-customer. Per 1,000 visitors, how many customers does each produce, and what additional information would you need to choose?
Show answer
A produces 1,000 x 0.06 x 0.05 = 3 customers. B produces 1,000 x 0.035 x 0.114 = about 4 customers. To choose you need confidence that the difference is real (the counts are tiny, so run a larger sample), plus the cost of handling each lead and the value of each customer.