Sub topic 14
Measuring conversion and testing changes
This chapter assumes you can build a basic sign-up form and pop-up in HTML and JavaScript, and that you know what an email service provider reports. By the end you should be able to define conversion rate, record the events behind it, and run a simple A/B test.
Define conversion rate precisely
Conversion rate is the share of people who saw a form and then subscribed. Two choices change the number a lot.
- Denominator: use impressions (times the form was shown), not page views. A pop-up that opens only after a scroll is shown to a fraction of visitors.
- Numerator: with double opt-in, count confirmed subscribers, not form submissions. Submissions include typos and bots.
| Metric | Formula | What it tells you |
|---|---|---|
| Submit rate | submissions ÷ impressions | How persuasive the offer and form are |
| Confirmation rate | confirmed ÷ submissions | Email quality and confirmation email delivery |
| Overall conversion | confirmed ÷ impressions | The result you care about |
Compare forms of the same type. Inline forms usually convert at a lower rate than pop-ups because they are shown to everyone, so a pop-up beating an inline form says little.
Record the events
Your email service provider only sees submissions. Impressions have to come from your page. This script assigns each visitor to a variant once, then reports events.
const dialog = document.querySelector('#signup-dialog');
function getVariant() {
let v = localStorage.getItem('signupVariant');
if (!v) {
v = Math.random() < 0.5 ? 'A' : 'B';
localStorage.setItem('signupVariant', v);
}
return v;
}
function track(event) {
const body = JSON.stringify({ event, variant: getVariant(), at: Date.now() });
navigator.sendBeacon('https://example.com/events', body);
}
// Count an impression when the dialog opens.
new MutationObserver(() => {
if (dialog.open) track('impression');
}).observe(dialog, { attributes: true, attributeFilter: ['open'] });
dialog.querySelector('form[action]').addEventListener('submit', () => track('submit'));Storing the variant keeps a returning visitor from seeing both versions. Show the variant's headline or offer by reading getVariant() before the dialog opens.
Run a basic A/B test
- Write a hypothesis, such as "A headline naming the benefit raises overall conversion."
- Change one thing. If you change the headline and the button together, you cannot tell which one worked.
- Split traffic randomly and evenly, as the script above does.
- Decide the sample size before you start. To detect a rise from 3% to 4%, you need roughly 5,000 impressions per variant. Small lifts need many more.
- Run the test for whole weeks, because weekday and weekend visitors behave differently.
- Do not stop early because one variant looks ahead. Early gaps are often noise.
Judge the result with a significance test or your testing tool's calculator. A difference that could easily happen by chance is not a win.
Common errors
- Counting submissions as subscribers when double opt-in is on.
- Ending a test after a few days or after the first lead appears.
- Testing several changes at once with too little traffic.
- Treating a one-time spike from a viral post as a lasting result. Segment by traffic source if you can.
- Forgetting that a frequency cap changes who sees the form, so reset or log it consistently across variants.
Exercise
Your pop-up was shown 4,000 times. It received 200 submissions, and 140 people clicked the confirmation link. What are the submit rate, the confirmation rate, and the overall conversion rate?
Show answer
Submit rate is 200 ÷ 4,000 = 5%. Confirmation rate is 140 ÷ 200 = 70%. Overall conversion is 140 ÷ 4,000 = 3.5%.
Exercise
Variant B shows a 20% higher submit rate after two days, and a colleague wants to ship it. Name two reasons to keep the test running.
Show answer
Two days is too short and may miss weekday and weekend differences. The planned sample size has probably not been reached, so the gap may be chance. You also have not checked confirmation rate or unsubscribes for variant B.