Revenue attribution
How Trakily links payments to the visitors, channels and pages that brought them.
Trakily imports payments from your payment provider and links each one to the visitor who paid. That's what puts revenue next to every channel, referrer, campaign, page and country on your dashboard.
Supported providers
| Provider | Credential | Webhook | Success page detected |
|---|---|---|---|
| Stripe | Restricted API key | Registered for you | ?session_id=… |
| Polar | Organization access token | Added by hand (optional) | ?checkout_id=… |
| Lemon Squeezy | API key | Registered for you | ?order_id=… |
| Paddle | API key | Registered for you | No |
| Dodo Payments | API key | Added by hand (optional) | ?payment_id=… |
| Razorpay | Key ID + Key Secret | Added by hand (optional) | ?razorpay_payment_id=… |
- Provider
- Stripe
- Credential
- Restricted API key
- Webhook
- Registered for you
- Success page detected
?session_id=…
- Provider
- Polar
- Credential
- Organization access token
- Webhook
- Added by hand (optional)
- Success page detected
?checkout_id=…
- Provider
- Lemon Squeezy
- Credential
- API key
- Webhook
- Registered for you
- Success page detected
?order_id=…
- Provider
- Paddle
- Credential
- API key
- Webhook
- Registered for you
- Success page detected
- No
- Provider
- Dodo Payments
- Credential
- API key
- Webhook
- Added by hand (optional)
- Success page detected
?payment_id=…
- Provider
- Razorpay
- Credential
- Key ID + Key Secret
- Webhook
- Added by hand (optional)
- Success page detected
?razorpay_payment_id=…
What gets imported
- Payments: one-time payments, first subscription payments and renewals, with amount, currency, customer email and date.
- Refunds, which reduce revenue for the period they happen in.
- Subscriptions: plan, status, trial and price, which power SaaS metrics.
The first sync imports your whole history, so MRR, churn and LTV are right for long-time customers. Later syncs run every 15 minutes and overlap the previous one by two days, so late changes aren't missed. Failed, pending and incomplete payments are ignored.
Revenue is shown in the site's reporting currency, set in Settings → Revenue → Reporting currency. Payments in other currencies are converted with daily ECB exchange rates.
How matching works
For each payment Trakily looks for evidence of who paid, strongest first. A payment is only re-linked by evidence at least as strong as what it already has.
| Evidence | How it works | You need to |
|---|---|---|
| Checkout metadata | Your checkout passes the visitor id (trakily_visitor_id) to the provider, which returns it with the payment. | Add a few lines to your checkout code (step 4 on each provider page). |
| Success page | The script sees the checkout id in the URL of your thank-you page and reports it. The payment with that id is linked to that visitor. | Redirect buyers back to your site with the checkout id in the URL. |
| Refunds and renewals | A refund inherits the visitor of the payment it refunds; a renewal inherits the visitor of the subscription's earlier payment. | Nothing. |
| The customer's email from the provider is matched to an identify or payment call with the same email, made before the payment (or up to a day after). | Call identify with an email. |
- Evidence
- Checkout metadata
- How it works
- Your checkout passes the visitor id (trakily_visitor_id) to the provider, which returns it with the payment.
- You need to
- Add a few lines to your checkout code (step 4 on each provider page).
- Evidence
- Success page
- How it works
- The script sees the checkout id in the URL of your thank-you page and reports it. The payment with that id is linked to that visitor.
- You need to
- Redirect buyers back to your site with the checkout id in the URL.
- Evidence
- Refunds and renewals
- How it works
- A refund inherits the visitor of the payment it refunds; a renewal inherits the visitor of the subscription's earlier payment.
- You need to
- Nothing.
- Evidence
- How it works
- The customer's email from the provider is matched to an identify or payment call with the same email, made before the payment (or up to a day after).
- You need to
- Call identify with an email.
Success-page and email matching work without code changes in your checkout, but they depend on the buyer returning to your site or being identified. Passing the visitor id in metadata works every time, even if the buyer closes the tab after paying.
Success page parameters
The script checks every page URL for these parameters and reports each checkout id once per tab:
| Provider | Parameter |
|---|---|
| Stripe | session_id=cs_… |
| Polar | checkout_id=… |
| Lemon Squeezy | order_id=… |
| Dodo Payments | payment_id=pay_… or subscription_id=sub_… together with status |
| Razorpay | razorpay_payment_id=… |
- Provider
- Stripe
- Parameter
session_id=cs_…
- Provider
- Polar
- Parameter
checkout_id=…
- Provider
- Lemon Squeezy
- Parameter
order_id=…
- Provider
- Dodo Payments
- Parameter
payment_id=pay_…orsubscription_id=sub_…together withstatus
- Provider
- Razorpay
- Parameter
razorpay_payment_id=…
To turn this off, add data-disable-payments="true" to the script tag.
How revenue is counted
- Revenue = new payments + renewals − refunds in the period.
- Conversions are new payments (first purchases and first subscription payments). Conversion rate = conversions ÷ visitors.
- Revenue per visitor = revenue ÷ visitors.
- Breakdowns credit a payment to the session that led to it: the session id from checkout metadata, otherwise the buyer's latest session before paying. Each session's source, campaign and entry page come from its first pageview.
- SaaS channel economics and the Meta Ads card use the customer's first touch instead.
Disconnecting
Disconnecting removes the key. Payments already imported stay, so your historical revenue doesn't disappear. Reconnecting imports the history again; payments that are already there are updated, not duplicated.