Sub topic 13
Test and Refine Hero Variants
This chapter assumes you can build a hero in HTML and CSS, that you know what a primary call to action (CTA) is, and that you have already written a headline, subheadline and CTA for your offer. Here you learn how to compare two versions of a hero and decide which one to keep.
Why test a hero at all
A hero is a set of guesses. You guess which words make the offer clear, which button label gets a click, and which image helps. Opinions in a meeting do not settle these guesses. A test does.
A test shows two groups of real visitors two different heroes and compares what each group does. This is called an A/B test. Version A is the control, which is the current hero. Version B is the variant, which is the one change you want to try.
Testing has limits. It tells you which version performed better. It does not tell you why. Pair it with the reasoning you did in earlier chapters, so you can explain a result instead of only recording it.
Pick one question and one metric
Start with a question in the form "Will changing X improve Y?" Two parts matter.
- X is one element. Change the headline, the CTA label, or the image. Do not change all three at once. If you do, you cannot tell which change caused the result.
- Y is one primary metric. Choose the action the hero exists to produce.
For the Ledgerly hero, the primary action is starting a free trial. A good primary metric is the share of visitors who click the CTA and then reach the signup form. This share is the conversion rate, calculated as conversions divided by visitors.
Add guardrail metrics too. A guardrail is a number that must not get worse while you improve the primary metric. Useful guardrails for a hero are bounce rate (visitors who leave after one page), page load time, and the share of signups that finish onboarding. A vague headline can raise clicks from curious visitors who then never use the product. The guardrail on onboarding completion catches that.
| Metric type | Example for Ledgerly | Why it matters |
|---|---|---|
| Primary | Visitors who click "Start free trial" and reach the signup form | The action the hero exists to produce |
| Secondary | Scroll depth past the hero | Shows whether visitors keep reading |
| Guardrail | Trial signups that finish onboarding | Catches clicks that do not lead to real use |
| Guardrail | Largest Contentful Paint (LCP) | A heavier variant can slow the page |
Write a hypothesis
A hypothesis states the change, the expected result and the reason. Writing the reason forces you to link the test to the visitor's intent from the start of this tutorial.
Hypothesis:
If we change the headline from "Invoicing, simplified" to
"Send invoices in under a minute", then more visitors will click
"Start free trial", because the new headline names a concrete outcome
that matches what freelancers searching for invoicing tools want.
Primary metric: CTA click-through to signup form
Guardrails: onboarding completion, LCP under 2.5 s
Change: headline text onlyIf the test loses, the "because" part is what you revisit. Maybe the audience cares more about getting paid than about speed. That points to your next variant.
Choose what to test first
You have limited traffic, so test the elements with the largest likely effect first. The order below usually works well.
- Headline. It carries the offer, so it has the most influence.
- CTA label and the line under it. "Start free trial" against "Create your first invoice" changes what the visitor expects to happen.
- Supporting visual. A product screenshot against an illustration changes how quickly the product is understood.
- Trust signals. Test their presence or position only after the offer itself is clear.
- Small styling changes. Button color and corner radius rarely matter unless contrast was a problem.
Run the test so the result can be trusted
A result is trustworthy only if the test follows a few rules.
Split traffic randomly and keep it stable
Each visitor should be assigned to A or B at random, and the same visitor should see the same version on every visit. Without that, a returning visitor who sees both versions muddies the data. Testing tools handle this with a cookie or a stored identifier. If you build the split yourself, derive the assignment from a stable ID instead of calling a random function on every page load.
// Assign a visitor to a hero variant and keep the assignment.
function getHeroVariant() {
const key = "hero_variant";
const saved = localStorage.getItem(key);
if (saved === "a" || saved === "b") {
return saved;
}
const variant = Math.random() < 0.5 ? "a" : "b";
localStorage.setItem(key, variant);
return variant;
}
const variant = getHeroVariant();
document.documentElement.dataset.heroVariant = variant;
const headline = document.getElementById("hero-title");
if (variant === "b") {
headline.textContent = "Send invoices in under a minute";
}This snippet is a teaching sketch. It has a real flaw, covered next.
Avoid flicker
If the page loads version A and JavaScript then swaps in version B, the visitor sees the headline change. This flicker harms the experience and can bias the result. It also pushes back the point where the hero is stable, which hurts LCP.
Better options are to choose the variant on the server and send the right HTML, or to use a testing tool that hides the hero until the swap is done. Server-side assignment is the cleaner choice for a hero because the hero is the first thing rendered.
Run both versions at the same time
Do not show A for one week and B the next. Traffic changes by weekday, by campaign and by season. Running both versions in parallel makes those changes affect both groups equally.
Do not stop early
Conversion rates move around a lot in the first days. If you check every morning and stop the moment B is ahead, you will often declare a winner that was only noise. This mistake is called peeking. Decide the sample size and the duration before you start, and stick to them.
A practical rule is to run for at least one or two full weeks, so every weekday appears at least once or twice. Then wait for the planned sample size.
How much traffic you need
The smaller the difference you want to detect, the more visitors you need. The table shows approximate numbers for a baseline conversion rate of 5%, at the usual 95% confidence and 80% power. These are rough figures. Use a sample size calculator for the real number.
| Relative lift you want to detect | New rate | Visitors needed per variant (approx.) |
|---|---|---|
| 40% | 7.0% | 1,100 |
| 20% | 6.0% | 4,000 |
| 10% | 5.5% | 15,500 |
If your site gets 500 visitors a week, a 10% lift is out of reach. In that case, do not run a formal test on small changes. Make bolder changes, such as a different offer framing, or use other evidence, covered below.
Read the result
When the test ends, compare the primary metric for the two groups.
- Check that the traffic split matches the plan, for example close to 50/50. A large mismatch signals a bug in assignment.
- Compare the primary metric and its confidence interval. If the interval for the difference includes zero, you have no clear winner.
- Check the guardrails. A variant that wins on clicks but loses on onboarding completion is not a win.
- Segment with care. Look at mobile against desktop, since a hero that stacks differently on a phone can behave differently. Treat segment findings as ideas for the next test, not as conclusions, because small segments are noisy.
A flat result is still information. It means the element you changed did not matter much to this audience. Move on to a bigger question.
When you cannot run a test
Low-traffic sites cannot reach the sample sizes above. You still have options that give useful evidence.
- Five-second test. Show the hero to a few people for five seconds, then ask what the product does and who it is for. If they cannot answer, the offer is not clear.
- Session recordings and heatmaps. Check whether visitors click the CTA, ignore it, or click things that are not links.
- User interviews. Ask freelancers what they expected from the page.
- Before and after comparison. Ship the change and compare the same period a week or month earlier. This is weaker evidence because other things change over time, so treat it as a hint.
Refine after the result
When a variant wins, ship it and record what you learned: the hypothesis, the numbers, the dates, and your best explanation. This record stops the team from repeating old tests.
When no variant wins, choose the next test from the reasoning in your hypothesis. If "names a concrete outcome" did not help, perhaps the outcome you named is not the one visitors care about. Go back to the audience and intent step and check your assumption.
Keep the cycle small. One change, one metric, one decision. Over several rounds, the hero converges on wording and a layout that match what your visitors want.
Common errors
- Changing several elements at once, then not knowing which one mattered.
- Stopping the test as soon as one version looks ahead.
- Using clicks as the only metric and ignoring what visitors do after the click.
- Running variants on different weeks.
- Letting the variant load late, so the page flickers and slows down.
- Treating a segment result from a small group as proof.
- Testing button color before testing whether the headline states the offer.
Exercise
Ledgerly gets about 800 visitors a week and a 5% baseline conversion rate. A teammate wants to test "Start free trial" against "Start free trial!" (adding an exclamation mark) and plans to stop after three days if B leads. Name two problems with this plan and say what you would do instead.
Show answer
First, the change is tiny, so the expected lift is far below what 800 visitors a week can detect. Detecting even a 10% relative lift needs roughly 15,500 visitors per variant. Second, stopping after three days if B leads is peeking, and three days also misses part of the weekly traffic cycle. Instead, test a bolder change, such as a CTA that names the outcome ("Create your first invoice"), or change the headline. Plan the duration in advance (at least two full weeks) and, given the low traffic, back the result with a five-second test or session recordings.
Exercise
A variant headline raises CTA clicks by 18%, but the share of trial signups that finish onboarding drops from 60% to 41%. Should you ship it? Explain using the terms from this chapter.
Show answer
Not yet. Onboarding completion is a guardrail metric, and it got worse while the primary metric improved. The new headline probably attracts visitors whose expectations do not match the product, so they click but do not use it. Revisit the hypothesis, make the headline more specific about what Ledgerly does, and test again.