Sub topic 14
Measuring conversion and testing changes
This chapter assumes you can build a basic sign-up form in HTML, write a little JavaScript, and know what an email service provider (ESP) does. You will learn which numbers to track, how to record them, and how to run a fair A/B test on a form or pop-up.
What to measure
A sign-up form is a small funnel. Visitors see it, some interact with it, and some submit it. With double opt-in, a further step follows: the subscriber confirms by email. Each step loses people, and each loss tells you something different.
| Metric | Definition | What a low value suggests |
|---|---|---|
| Impressions | Times the form or pop-up was actually shown | Trigger rarely fires, or the form sits below where people scroll |
| Submission rate | Submissions divided by impressions | Weak offer, too many fields, poor timing |
| Confirmation rate | Confirmed subscribers divided by submissions | Confirmation email is slow, lands in spam, or is unclear |
| Dismiss rate | Pop-up closes divided by impressions | Pop-up is intrusive or mistimed |
| Unsubscribe rate in the first 30 days | Early unsubscribes divided by new subscribers | The offer attracted the wrong people, or the welcome email did not match the promise |
Count an impression only when the form is visible. A pop-up that is queued but suppressed by a frequency cap is not an impression. An inline form below the fold is not an impression until the visitor scrolls to it.
Choose the right denominator
"Conversion rate" has more than one valid definition, so state yours.
- Per impression: submissions divided by times the form was shown. Best for comparing two versions of the same form.
- Per visitor: unique visitors who subscribed divided by unique visitors who could have seen the form. Best for judging a placement across a whole site.
- Per page view: simple to compute from analytics, but it counts repeat visitors many times and understates the rate for pop-ups that are capped.
Do not compare a per-page-view number from one source with a per-impression number from another.
Measure the quality of the list
Raw sign-ups can rise while the list gets worse. A pop-up with a large discount may double submissions and also double the share of people who never open an email. Pair the conversion rate with a quality measure taken a few weeks later, such as the confirmed rate, the open rate of the welcome email, or the share still subscribed after 30 days. Judge a change on both.
Record events
The simplest approach is to send named events to whatever analytics tool you use. The script below records four events for the pop-up from the previous chapters: shown, dismissed, submitted, and the variant that was displayed. It uses navigator.sendBeacon, which sends a small request that survives the page unloading. The /events endpoint is a placeholder for your own collection endpoint.
const dialog = document.querySelector('#signup-dialog');
const form = dialog.querySelector('form[action]');
function track(name, extra = {}) {
const payload = JSON.stringify({
event: name,
form: 'signup-dialog',
page: location.pathname,
time: Date.now(),
...extra
});
navigator.sendBeacon('/events', new Blob([payload], { type: 'application/json' }));
}
const observer = new MutationObserver(() => {
if (dialog.open) {
track('form_shown');
observer.disconnect();
}
});
observer.observe(dialog, { attributes: true, attributeFilter: ['open'] });
dialog.addEventListener('close', () => {
if (dialog.returnValue !== 'submitted') track('form_dismissed');
});
form.addEventListener('submit', () => {
dialog.returnValue = 'submitted';
track('form_submitted');
});A few details matter here:
- The
openattribute changes whenshowModal()runs, so the observer fires at the moment the visitor can see the dialog. It disconnects after the first event so a single display is not counted twice. - A real submit navigates away, so a normal
fetchcall might be cancelled.sendBeaconavoids that. - Do not put the email address in an analytics event. Events should describe behavior, not identify people.
If you send events to a third-party tool, check your consent rules from the earlier chapter. In many regions, analytics cookies or identifiers need consent, so a visitor who declined them may need to be excluded from tracking, or tracked in a cookieless way.
Run an A/B test
An A/B test shows version A (the control) to some visitors and version B (the variant) to others, then compares the rates. Random assignment is what lets you say that a difference came from your change and not from who happened to see it.
Test one change at a time
Change the headline, or the number of fields, or the trigger. If you change all three, you cannot tell which one mattered. If you want to test several changes together, that is a multivariate test and it needs much more traffic.
Good first candidates, roughly in order of typical impact:
- The offer itself (a checklist versus a discount versus nothing).
- The trigger (scroll depth versus time on page).
- The headline and button text.
- The number of fields.
Assign visitors consistently
A visitor must see the same version on every visit. Otherwise one person is counted in both groups and the results blur. Store the assignment in localStorage and reuse it.
function getVariant(testName) {
const key = 'ab_' + testName;
let v = localStorage.getItem(key);
if (v !== 'A' && v !== 'B') {
v = Math.random() < 0.5 ? 'A' : 'B';
localStorage.setItem(key, v);
}
return v;
}
const variant = getVariant('popup-headline');
document.querySelector('#signup-title').textContent =
variant === 'A' ? 'Get the free checklist' : 'Download the 10-point launch checklist';Include variant in every event you send, so you can split the numbers later.
flowchart TD
placeholder[Not rendered]That block is intentionally not used. The real diagram follows.
Decide how long to run it
The most common testing error is stopping as soon as one version is ahead. Early results swing widely because the sample is small. Decide before you start:
- The metric you will judge on (for example, submissions per impression).
- The smallest improvement worth acting on.
- The sample size you need, or a fixed end date.
As a rough guide, detecting a lift from a 3% to a 4% submission rate with usual confidence settings needs several thousand impressions per version. Smaller lifts need far more. A site with 200 impressions a week cannot test small changes. It should test bold ones, such as a different offer, where the difference may be large enough to see.
Also run the test for at least one or two full weeks. Visitors behave differently on weekdays and weekends, and a test that covers only a few days can be biased by that.
Check whether the difference is real
With results in hand, compute the rate for each version and ask whether the gap could be chance. A two-proportion z-test is the standard tool. The script below runs in Python with no extra packages.
from math import sqrt, erf
def two_proportion_test(shown_a, subs_a, shown_b, subs_b):
p_a = subs_a / shown_a
p_b = subs_b / shown_b
pooled = (subs_a + subs_b) / (shown_a + shown_b)
se = sqrt(pooled * (1 - pooled) * (1 / shown_a + 1 / shown_b))
z = (p_b - p_a) / se
p_value = 2 * (1 - 0.5 * (1 + erf(abs(z) / sqrt(2))))
return p_a, p_b, z, p_value
p_a, p_b, z, p = two_proportion_test(4000, 120, 4000, 156)
print(f"A: {p_a:.2%} B: {p_b:.2%} z={z:.2f} p={p:.3f}")With these numbers, A converts at 3.00% and B at 3.90%, and the p-value is about 0.03. A p-value below 0.05 is the usual threshold for calling a result unlikely to be chance. It does not tell you how big or how valuable the effect is, so also look at the size of the lift.
Common errors
- Counting impressions that never rendered, which lowers the apparent rate for every version.
- Splitting traffic unevenly by device. If variant B happens to get more desktop visitors and desktop converts better, B looks better for the wrong reason. Check the split by device type.
- Running two tests on the same visitors that interact, such as a new pop-up trigger and a new headline at once.
- Judging only on sign-ups. A variant that wins on submissions and loses on confirmations or 30-day retention is not a win.
- Ignoring bots. Spam submissions inflate the numbers, so exclude submissions caught by the honeypot or failing confirmation.
- Declaring a result without a record of what was changed and when. Keep a short log of each test: hypothesis, dates, versions, result, decision.
What to do with the result
If B wins on both submission rate and quality, make it the new control and plan the next test. If the result is inconclusive, that is information too: the change did not matter much, so choose the simpler or cheaper version. If B wins on sign-ups but the quality measure drops, keep A or test a middle option.
Exercise
A pop-up with a 20% discount lifts the submission rate from 2.5% to 5% in a two-week test with 6,000 impressions per version. Which other numbers would you check before keeping it, and why?
Show answer
Check the confirmation rate, the open rate of the welcome email, and the share of subscribers still on the list after 30 days. A discount can attract people who want only the code, so submissions rise while engaged subscribers do not. Also check whether the device split was even and whether bot submissions were removed from both versions.
Exercise
A site gets 150 pop-up impressions a week. The owner wants to test whether changing the button text from "Subscribe" to "Send me the guide" improves sign-ups. Is this a good test? What would you suggest?
Show answer
No. Button text usually produces a small lift, and 150 impressions a week is far too few to detect a small difference. Test a larger change instead, such as a different offer, and run it for several weeks. You could also wait until traffic grows, or judge by qualitative feedback in the meantime.