The first revenue event most of us add to a product is the easy one: a "purchase" event fired from the thank-you page after checkout. It works on day one, it shows up in the dashboard, and it feels like revenue tracking is done.
For a subscription product, that event sees a small part of the money. Renewals happen on a server at 3 a.m. with nobody on the page. Refunds arrive two weeks later. Upgrades are charged in the middle of a billing cycle. Payment providers retry webhooks. None of that passes through a thank-you page.
In an earlier piece, Which Channel Actually Pays?, I looked at how attribution models and lookback windows change which channel gets the credit. This one is about the step before that: which revenue events you send at all, and what each missing one does to the numbers.
The setup
I wrote a seeded simulation of one year (2026) of billing for a small, made-up SaaS. Every rate in it is an assumption I chose, not a measurement of any real product:
- About 1.5 new buyers a day, 550 in total, from five channels: organic search, a launch directory, a newsletter, docs and referrals, and direct.
- Plans: $19 a month or $190 a year (25% pick annual). Monthly customers can upgrade to a $49 plan mid-cycle, which charges a prorated difference.
- Refunds within 14 days, at a different rate per channel: 3% for organic search and docs, 5% for the newsletter, 6% for direct, 12% for the launch directory. Monthly churn ranges from 3% (docs) to 10% (launch directory). About 1% of buyers end in a chargeback, with a $15 fee.
- Two "plumbing" assumptions: 7% of completed checkouts never fire the thank-you page event (closed tab, blocked script, redirect timeout), and 4% of webhooks arrive twice because the provider retries.
The payment provider's view of that year has 2,390 billing events:
| Event | Count | Amount |
|---|---|---|
| First purchase | 550 | $33,364 |
| Renewal | 1,713 | $43,977 |
| Mid-cycle upgrade | 96 | $1,440 |
| Refund | 25 | -$1,159 |
| Chargeback | 6 | -$375 |
| Money actually kept | $77,247 |
More than half of the year's revenue is renewals. That's normal for a subscription business and it's the first thing a thank-you page event can't see.
Six tracking setups, same year
Then I replayed the same events through six analytics setups, from the minimum to the complete one:
| Setup | Revenue the analytics shows | vs. provider |
|---|---|---|
| 1. Thank-you page purchase event only | $32,053 | -58.5% |
| 2. Server-side purchase + renewals | $77,341 | +0.1% |
| 3. + refunds and chargebacks, without the order link | $75,807, of which -$1,534 "unattributed" | -1.9% |
| 4. + refunds and chargebacks, tied to the order | $75,807 | -1.9% |
| 5. Everything, webhook retries not deduplicated | $80,134 | +3.7% |
| 6. Everything, deduplicated by event ID | $77,247 | 0.0% |
A few things in this table are worth slowing down for.
Setup 1 sees 41% of the money. It misses every renewal and upgrade, and it also misses the 7% of purchases whose thank-you page never fired. It counts refunded purchases as revenue, too, because the refund never reaches it.
Setup 2 is right by accident. Its total is within 0.1% of the truth, but only because two errors almost cancel out: it misses $1,440 of upgrades and it ignores $1,534 of refunds and chargebacks. A month with a refund spike or an upgrade campaign would break that luck. A total that matches doesn't mean the events are right.
Setups 3 and 4 have the same total and different reports. In setup 3 the refund events are sent as negative revenue but without the order or visitor they belong to, so the analytics tool can't connect them to a channel. They pile up in an "unattributed" bucket, and every channel looks better than it is. Setup 4 sends the same refunds with the original order, so each one is charged back to the channel that brought the buyer.
Setup 5 counts some money twice. If your webhook handler forwards every delivery, every retry becomes another renewal. In this simulation that added $2,887, or 3.7%, to the year. Setup 6 drops repeats by the provider's event ID and lands exactly on the provider's number.
What the missing events do to channels
Totals are only half of it. Here is each channel in the complete setup, next to what the thank-you page alone reported:
| Channel | First payments | Renewals + upgrades | Refunds + chargebacks | Net (complete) | Thank-you page only |
|---|---|---|---|---|---|
| Organic search | $9,348 | $14,682 | -$91 | $23,939 | $8,835 |
| Launch directory | $8,588 | $10,461 | -$1,033 | $18,016 | $8,531 |
| Newsletter | $5,016 | $8,923 | -$334 | $13,605 | $4,712 |
| Docs / referral | $6,745 | $7,231 | -$19 | $13,957 | $6,365 |
| Direct | $3,667 | $4,120 | -$57 | $7,730 | $3,610 |
With the thank-you page event alone, organic search and the launch directory look almost tied: $8,835 against $8,531, a 3.6% gap. With renewals and refunds included, organic search is ahead by $5,923, or 33%. The launch directory's buyers refunded 12% of their first payments and churned faster, and only the complete setup shows it.
The newsletter moves the other way. On the thank-you page it looks 26% weaker than docs and referrals. Once you count the renewals of its buyers, the gap is under 3%.
Nothing about the buyers changed between those two columns. Only the events did.
Timing: the refund lands in a different month
One more detail that trips up monthly reports: refunds and chargebacks don't happen on the purchase date. In this simulation, 9 of the 31 (29%) landed in a later calendar month than the purchase they reverse, $432 in total.
If your report books each refund on the day it happened, a quiet month can show negative revenue from last month's launch. If you book it against the purchase, last month's numbers change after you've already shared them. Both are fine, as long as you choose one on purpose and know which one your tool uses. The event needs the refund's own date and the original order to support either view.
The same goes for judging a launch. Launch-directory buyers who bought in March paid $722 in first payments. By December the same buyers had added $1,685 in renewals and upgrades and lost $19 to refunds: $2,388 in total, 3.3 times the March number. A report that stops at the first payment underrates a launch with loyal buyers and overrates one with refunders.
The event design that matched
Every revenue event in setup 6 came from the server, from the payment provider's webhooks, not from the browser. Each one carries the same few things:
- An event ID from the provider, used to drop retries.
- The order or subscription ID, so refunds, renewals and upgrades connect to the first purchase.
- The visitor or customer reference stored at checkout, so the analytics tool can put later events on the same journey, where your privacy settings allow it.
- A type: purchase, renewal, plan change, refund, chargeback.
- A signed amount in minor units (cents), with refunds and chargebacks negative.
- The currency, never converted on the way in.
- The date it happened, not the date your handler processed it.
Here is that mapping as a small function. The webhook types and field names are illustrative, not any one provider's, so map them to your provider's events and to the fields your analytics tool documents:
seen = set() # use a database table with a unique key in production
orders = {} # order_id -> visitor/channel info stored at checkout
def to_revenue_event(hook):
if hook['id'] in seen: # provider retries reuse the same event ID
return None
seen.add(hook['id'])
kind = {'checkout.completed': 'purchase', 'invoice.paid': 'renewal',
'subscription.updated': 'plan_change', 'charge.refunded': 'refund',
'dispute.lost': 'chargeback'}.get(hook['type'])
if kind is None:
return None
if hook['type'] == 'invoice.paid' and hook.get('first_invoice'):
return None # the first invoice is the purchase, already sent
sign = -1 if kind in ('refund', 'chargeback') else 1
origin = orders.setdefault(hook['order_id'], {'visitor': hook.get('visitor')})
return {'event': kind, 'event_id': hook['id'], 'order_id': hook['order_id'],
'visitor': origin['visitor'], # refunds and renewals inherit the buyer
'amount_minor': sign * abs(hook['amount']), 'currency': hook['currency'],
'occurred_at': hook['created']}
Fed seven sample webhooks for one order (a first invoice, the checkout, a renewal delivered twice, an upgrade, a partial refund and an unrelated customer update), it produced four events:
ev0 invoice.paid -> None
ev1 checkout.completed -> {'event': 'purchase', ..., 'visitor': 'v-7f3', 'amount_minor': 1900, ...}
ev2 invoice.paid -> {'event': 'renewal', ..., 'visitor': 'v-7f3', 'amount_minor': 1900, ...}
ev2 invoice.paid -> None
ev3 subscription.updated -> {'event': 'plan_change', ..., 'visitor': 'v-7f3', 'amount_minor': 1500, ...}
ev4 charge.refunded -> {'event': 'refund', ..., 'visitor': 'v-7f3', 'amount_minor': -1500, ...}
ev5 customer.updated -> None
The first invoice is skipped because the checkout already counts as the purchase (otherwise every first payment is counted twice, which is another quiet way to inflate revenue). The retried renewal is dropped. The refund inherits the buyer of order o42, so it lands on the right channel. In production, seen and orders belong in a database table with a unique key, not in memory.
A checklist before you trust a revenue report
- List the money events your provider sends, not the ones your front end sees. Purchases, renewals, upgrades and downgrades, refunds (full and partial), chargebacks.
- Send them from the server. Keep the thank-you page event if you like it for funnels, but don't make it your revenue source.
- Tie every later event to the original order. A refund without an order ID is negative money with no owner.
- Deduplicate by the provider's event ID, and don't send both a "checkout completed" and a "first invoice paid" for the same payment.
- Keep currencies apart and store the date each event happened.
- Reconcile once a month. Compare the analytics total for the month with the provider's payout report. A gap of a few percent is a missing or duplicated event type, not noise.
Where DataVisitors fits
DataVisitors is the privacy-friendly analytics tool from the team behind FindUtils. It's waitlist-only right now. Its revenue page describes recorded revenue events per currency, with no converted grand total, and a comparison of first-click and last-click attribution for a goal. It's also clear that the reports depend on the events you send and that it isn't an accounting ledger. The HTTP API page is built for exactly the events in this article: a subscription renewed, a payment webhook arrived, a purchase confirmed after the tab closed. It uses separate ingest and read keys. If that sounds useful, the waitlist is open.
Whatever tool you use, the lesson from the simulation is the same: the report can't be more complete than the events behind it. The thank-you page is where revenue tracking starts, not where it ends.
Need help with a project? The team behind FindUtils takes on freelance work on Upwork, including a Laravel Livewire app or admin panel with dynamic pages and forms, for example a revenue dashboard that reports net, not gross.
Top comments (5)
The setup 2 point is the one I'd stress: a total within 0.1% that is right only because missed upgrades and ignored refunds cancel out. That kind of luck hides until a refund spike lands. The dedup row matters just as much. Provider event IDs are the natural idempotency key, but they only help if you store the ID before applying any side effect, and apply the side effect in the same transaction. Otherwise a retry arriving during processing can still double count. Another pitfall is out-of-order delivery: a refund webhook can land before the payment event it refers to, so the handler should tolerate an unknown order and reconcile later instead of dropping it. Do you treat the provider's ledger as the source of truth and rebuild analytics from it periodically, or only stream events as they arrive?
Great points, thank you! Saving the event ID together with the change, and tolerating a refund that shows up before its payment, are both worth spelling out. For money numbers, treating the payment provider's records as the reference and reconciling against them now and then is a safe default; the event stream is for speed, the ledger for the final number.
Renewals at 3 a.m. with nobody on the page is the line that sums it up. In our experience the webhook retries are the quiet killer: without an idempotency key per payment event, one retried renewal shows up as two in the dashboard and nobody notices for months.
Thanks! That double-counted renewal is exactly the kind of error that looks fine at a glance, which is why we gave deduplication its own row in the comparison.
Some comments may only be visible to logged-in visitors. Sign in to view all comments.