Sub topic 11
Exporting Data and Calculating Your Own Metrics
This chapter assumes you can already read the traffic, revenue, and engagement views on Udemy and Teachable, and that you know the basic terms: visitors, conversion rate, net revenue, and completion rate. It also assumes you can run a short Python script. The goal is to take figures out of the dashboards and compute exactly what you need, with definitions you control.
Why calculate your own metrics
Dashboards give you ready-made numbers, but they have three limits:
- Fixed definitions. A platform's "completion" or "conversion" may use a denominator you would not choose. You often can't see which one it uses.
- Fixed views. You can usually look at one period or one report at a time. Comparing two sources across two months may need several screens.
- No custom ratios. Net revenue per visitor, or completion among students who started, is rarely shown directly.
Exporting lets you apply the same definition every time. That makes this month comparable to last month, and one course comparable to another.
What you can export
Export options differ by platform, by plan, and over time. Check your own account instead of assuming a report exists. Typical possibilities are:
| Data | Usually found as | Typical use |
|---|---|---|
| Traffic and conversion | A report or chart, sometimes downloadable | Conversion by source |
| Revenue and refunds | A revenue report or transaction list | Net earnings |
| Student progress | A student list or progress report | Completion rate |
| Reviews and ratings | A reviews page, often copied by hand | Qualitative review |
If a view has no download button, you can still type the handful of figures you need into a spreadsheet or script. Ten accurate numbers are worth more than a large export you don't understand.
A workflow that avoids silent errors
Most mistakes in self-made metrics come from skipping a step, not from hard maths. Follow the same order each time.
Step E matters most. If your total revenue for a month differs from the dashboard's, find out why before you trust any derived number. Common causes are time zones, refunds counted in a different month, and taxes or platform fees included in one figure but not the other.
Calculating conversion and net revenue
Start with the figures you would read off a traffic and revenue report. The script below computes conversion rate, refund-adjusted revenue, and net revenue per visitor.
visitors = 1200
enrollments = 36
revenue = 540.00
refunds = 45.00
conversion_rate = enrollments / visitors
net_revenue = revenue - refunds
print(f'Conversion rate: {conversion_rate:.1%}')
print(f'Net revenue: {net_revenue:.2f}')
print(f'Net revenue per visitor: {net_revenue / visitors:.2f}')The output is a 3.0% conversion rate, net revenue of 495.00, and 0.41 per visitor.
Net revenue per visitor is useful because it combines two things that move separately: how many visitors enroll, and how much each enrollment is worth after refunds. A price cut might raise conversion and still lower this number.
Note that the "revenue" here is whatever figure your report shows. On a marketplace, that figure may already be your share after the platform's cut. On your own school, it may be the gross amount before payment-processor fees. Write down which one you used.
Completion rate depends on the denominator
Completion rate is a fraction, and the answer changes with what you put at the bottom. The next script reads a small progress export and computes it two ways.
import csv
import io
raw = '''student_id,progress_percent
s1,100
s2,45
s3,100
s4,10
s5,0
'''
rows = list(csv.DictReader(io.StringIO(raw)))
completed = sum(1 for r in rows if float(r['progress_percent']) >= 100)
started = sum(1 for r in rows if float(r['progress_percent']) > 0)
print(f'Completion rate (all enrolled): {completed / len(rows):.0%}')
print(f'Completion rate (started only): {completed / started:.0%}')The first figure is 40%, the second is 50%. Both are correct. They answer different questions:
- All enrolled measures how well the course converts a purchase into a finished course. It includes students who never opened a lesson.
- Started only measures how well the content holds people who did begin. It is the better signal for lesson quality.
The column name progress_percent is an example. Your export may name it differently, may store progress as a fraction between 0 and 1, or may report lessons completed instead of a percentage. Adjust the threshold test to match.
Combining rows correctly
When you segment by source or month, you will have several rows to combine. Add the numerators and denominators first, then divide. Do not average the percentages.
Suppose one source has 10 visitors and 5 enrollments (50%), and another has 1,000 visitors and 10 enrollments (1%). The average of the two percentages is 25.5%, but the true combined rate is 15 out of 1,010, about 1.5%. The averaged figure gives a tiny group the same weight as a huge one.
The script below groups by traffic source, sums the raw counts, and then calculates each ratio. It guards against a zero denominator.
import csv
import io
from collections import defaultdict
raw = '''month,source,visitors,enrollments,revenue,refunds
2026-09,search,500,10,150.00,15.00
2026-09,email,100,12,180.00,0.00
2026-10,search,600,12,180.00,30.00
2026-10,email,120,18,270.00,15.00
'''
def ratio(numerator, denominator):
return numerator / denominator if denominator else None
def pct(value):
return 'n/a' if value is None else f'{value:.1%}'
totals = defaultdict(
lambda: {'visitors': 0, 'enrollments': 0, 'revenue': 0.0, 'refunds': 0.0}
)
for row in csv.DictReader(io.StringIO(raw)):
t = totals[row['source']]
t['visitors'] += int(row['visitors'])
t['enrollments'] += int(row['enrollments'])
t['revenue'] += float(row['revenue'])
t['refunds'] += float(row['refunds'])
for source, t in sorted(totals.items()):
conversion = ratio(t['enrollments'], t['visitors'])
net = t['revenue'] - t['refunds']
per_visitor = ratio(net, t['visitors'])
print(
f"{source}: conversion {pct(conversion)}, "
f"net {net:.2f}, net per visitor {per_visitor:.2f}"
)The output is:
email: conversion 13.6%, net 435.00, net per visitor 1.98
search: conversion 2.0%, net 285.00, net per visitor 0.26Email converts far better than search, which is expected: email readers already know you. But email has only 220 visitors in this sample. Treat a gap like this as a lead to check, not a proven fact. The next chapter covers small samples in detail.
Checking your numbers
Before you rely on a calculated metric, run these checks:
- Reconcile totals. Sum your exported revenue and enrollments for a period and compare them with the dashboard's totals for the same period.
- Check the period boundaries. Confirm the first and last dates, and the time zone the platform uses.
- Look for duplicates. Some exports list one row per transaction, others one row per student. Counting transaction rows as students inflates enrollment.
- Check units. Percentages stored as 45 and as 0.45 will break a threshold test without raising an error.
- Handle empty cells. A blank progress value is not the same as zero. Decide whether blanks mean "not started" or "unknown", and say so.
Common errors
| Error | What goes wrong | Fix |
|---|---|---|
| Averaging percentages | Small groups get too much weight | Sum counts, then divide |
| Dividing by zero | A source with no visitors crashes the script or gives nonsense | Guard the denominator |
| Mixing gross and net | Revenue looks higher than payouts | Name the revenue basis in your notes |
| Changing definitions | Month-to-month trends become meaningless | Write each definition once and reuse it |
| Trusting one export | A filter left on hides rows | Reconcile with the dashboard |
Keep a metric log
Keep one small file or spreadsheet tab where each row records the date, the period covered, the source of the figures, and the definition used. When you later change a course page, this log lets you compare before and after on the same footing. That is the basis of the last chapter's action loop.
Exercise
A progress export has 200 enrolled students. 120 have progress above 0, and 60 have reached 100. Calculate the completion rate for all enrolled students and for students who started. Then say which figure you would use to judge lesson quality and why.
Show answer
All enrolled: 60 / 200 = 30%. Started only: 60 / 120 = 50%. Use the started-only figure to judge lesson quality, because it excludes the 80 students who never began and so reflects how well the content keeps people who actually tried it. The all-enrolled figure is better for judging whether purchases turn into finished courses.
Exercise
Two traffic sources are in your export. Source A has 20 visitors and 4 enrollments. Source B has 980 visitors and 20 enrollments. What is the combined conversion rate, and why is averaging the two sources' individual rates wrong?
Show answer
Combined: (4 + 20) / (20 + 980) = 24 / 1000 = 2.4%. The individual rates are 20% and about 2.04%, and their average is about 11%. That average treats the 20-visitor group as equal to the 980-visitor group, so it overstates the true rate. Sum the counts first, then divide.