Sub topic 13
Measuring conversion rate
This chapter assumes you know how a landing page and an HTML form work, and that you can compute percentages and ratios. You will define conversion rate precisely, calculate it in code, and learn the errors that make the number misleading.
What conversion rate means
A conversion is the action you want a visitor to take. For a lead page, that action is a form submission. Conversion rate is the share of visitors who complete that action:
conversion rate = leads ÷ visitors
If 96 of 2,400 visitors submit the form, the rate is 4.0%. The number only has meaning if you fix two things first: what counts as a visitor, and what counts as a lead.
- Visitor: decide whether you count sessions, unique users, or page views. Pick one and keep it.
- Lead: count a submission only when the form succeeds. Do not count clicks on the button, and do not count the thank-you page if people can reload it.
Calculating it
The function below guards against a page with zero visitors, which would otherwise raise a division error.
def conversion_rate(leads, visitors):
if visitors == 0:
return 0.0
return leads / visitors
visitors = 2400
leads = 96
print(f"{conversion_rate(leads, visitors):.1%}") # 4.0%Where to measure
Conversion rate can be measured at each step of the funnel. Each step has its own rate, and the weakest step shows you where to work.
Your headline number is visit-to-lead. A low form-start rate points to weak copy or a weak offer. Many starters who never submit point to form friction, which the form design chapter covered.
Volume is not quality
A higher conversion rate does not always mean a better page. Compare two form variants on both the visit-to-lead rate and the lead-to-customer rate.
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")Variant A produces 6.0% leads but only 5.0% of those become customers. Variant B produces 3.5% leads, and 11.4% of those become customers. B yields more customers (4 against 3) from fewer leads. Judge a form by what happens after the lead arrives, not only by how many people submit.
Common errors
| Error | Why it misleads | Fix |
|---|---|---|
| Mixing traffic sources | Paid and email traffic convert at different rates, so the blend hides both | Report the rate per source |
| Counting duplicates | Repeat submissions from one person inflate leads | Deduplicate by email address |
| Counting bots | Spam submissions raise the rate without value | Filter spam and test submissions |
| Changing the definition | A new visitor count makes before and after incomparable | Record the definition and keep it fixed |
| Tiny samples | A rate from 20 visitors swings widely | Collect enough visitors before drawing conclusions |
| Ignoring the time window | Weekday and weekend behavior differ | Compare equal periods, covering full weeks |
Practical habits
- Write down the visitor and lead definitions before you collect data.
- Track the rate per traffic source and per page.
- Record the date range and the number of visitors next to every rate.
- Pair the visit-to-lead rate with a downstream rate such as lead-to-customer.
Exercise
A landing page received 1,800 visitors and 54 form submissions. Of those submissions, 6 were duplicates from the same people and 4 were spam. What is the conversion rate before and after cleaning the data?
Show answer
Before cleaning: 54 ÷ 1,800 = 3.0%. After removing 6 duplicates and 4 spam entries, 44 real leads remain: 44 ÷ 1,800 ≈ 2.4%. The cleaned figure is the honest one, because duplicates and spam are not new interested people.
Exercise
Form X gets 5.0% visit-to-lead and 2.0% lead-to-customer. Form Y gets 3.0% visit-to-lead and 4.0% lead-to-customer. With 1,000 visitors each, which produces more customers?
Show answer
X: 1,000 × 5.0% = 50 leads, and 50 × 2.0% = 1 customer. Y: 1,000 × 3.0% = 30 leads, and 30 × 4.0% = 1.2 customers. Y produces slightly more customers despite fewer leads, though both numbers are too small to be conclusive.