1
100%
u/DutyOnly4308
1 hour ago
Your payment provider knows the sale, your analytics knows the visit. How to join the two
Most small SaaS setups answer "how many visitors" and "how much revenue" separately, and nobody can say which post brought the paying customer.
The join is simple in principle:
1. **When someone clicks Buy, pass an id from the visit into the checkout.** Stripe Checkout has
client_reference_id and metadata. Polar and Lemon Squeezy also accept custom metadata on a checkout.
2. **When the payment webhook arrives, read that id back** and attach the order to the visit: its source, landing page, utm.
3. **Tag every link you share with its own utm_campaign**, one per post, not one per channel. "reddit" then becomes "this reply in this thread".
Things that will bite you:
- ad blockers drop some visits, so a few sales stay unattributed. That's fine, just count them instead of guessing.
- buyers who come back days later on another device
- refunds should take the credit back
You can do it yourself with a few lines of code and one table.
Disclosure: I build Globatics, a cookieless analytics tool that does this with Stripe, Polar and Lemon Squeezy. 5-day free trial, then from €9/month. How it credits sales: https://globatics.live/docs/revenue?utm_s…