Sub topic 14
Measuring conversion and testing one change at a time
This chapter assumes you can read basic HTML and JavaScript, and that you know what a conversion is: a visitor completing the one action your page exists to prompt. It builds on the call-to-action placements from the earlier chapters, where each button carries a data-cta attribute.
Define the number you measure
The conversion rate is the share of visitors who complete the goal.
conversion rate = conversions / visitorsIf 40 of 1,000 visitors start a trial, the rate is 4%. Fix two decisions before you collect data:
- The conversion event. For a trial page this is a completed signup, not a click on the button. A click shows interest. A signup shows the goal was met.
- The visitor count. Count unique visitors who landed on the page, not page views. A visitor who reloads five times should count once.
Track clicks as well, because they help you diagnose a problem. If many people click but few finish signing up, the page worked and the signup form did not.
Tag each call to action
The skeleton from earlier already marks each button with data-cta="hero" or data-cta="offer". This script reads that attribute, so you can compare placements.
document.querySelectorAll('[data-cta]').forEach((link) => {
link.addEventListener('click', () => {
console.log('cta_click', link.dataset.cta);
});
});Replace console.log with your analytics tool's event call. The event name stays the same and the placement name travels with it. You can then see whether the hero button or the offer button earns more clicks.
Test one change at a time
An A/B test shows version A (the control) to half of your visitors and version B (the variant) to the other half. You compare their conversion rates.
Change only one element per test. Suppose you rewrite the headline, swap the hero image, and change the button label all at once. If the rate rises, you cannot say which change caused it. One of them may even have hurt while another helped.
Good first candidates follow the structure of the page:
| Element | Example change |
|---|---|
| Headline | Name a specific benefit instead of a general one |
| Proof | Move the testimonial above the offer |
| Offer | Lead with "14-day trial" instead of the price |
| Call to action | "Start your free trial" instead of "Submit" |
Run the test fairly
Most testing errors come from stopping early or misreading small numbers.
- Write a hypothesis first. For example: "A headline that names the benefit will raise signups, because visitors currently cannot tell what the product does."
- Decide the sample size before you start. Small samples swing widely. A lead of 5 conversions to 3 means almost nothing.
- Do not stop the moment B pulls ahead. Checking daily and stopping at the first lead produces false winners.
- Cover whole weeks. Behavior differs between weekdays and weekends, so run for complete weeks.
- Split traffic randomly. Do not send one traffic source to A and another to B.
Read the result
If B wins by a clear margin at the planned sample size, adopt it and note why you think it worked. If the result is close, treat it as a tie. Keep the simpler version and test something else. A tie is still information: that element may not be what holds visitors back.
Exercise
A page has a new headline, a new hero image, and a new button label in version B. Version B converts 20% better. Why is this a weak test, and what would you do instead?
Show answer
Three elements changed at once, so you cannot tell which one caused the improvement, or whether one of them hurt. Run three separate tests, each changing a single element, and keep the changes that win.
Exercise
1,000 visitors reach your page and 30 sign up. What is the conversion rate, and why should a click on the button not be the conversion event?
Show answer
The rate is 30 / 1,000 = 3%. A click only shows interest. The signup is the goal of the page, so it is the event that shows the page worked.