How-to

# How to Track Dodo Payments Revenue by Traffic Source

Connect Dodo Payments payments to the visits, sources and UTM campaigns behind them: payment links with no code, checkout sessions, webhooks, renewals and refunds.

Last reviewed 23 November 2026 · 11 min read · By the [SuprAnalytics team](https://supranalytics.app/about) at SuprApps

Dodo Payments shows you every payment. It doesn't show you which post, search or newsletter sent the customer. To see that, a visitor id from your website analytics has to ride along with the checkout and come back with the payment.

Dodo makes this short: its payment links accept metadata in the URL, so the id can be added without any code. This guide covers payment links and checkout sessions, the webhook that reports each payment, how renewals and refunds count, and where attribution can't find a source.

## The quick answer

To attribute Dodo Payments revenue to traffic sources:

1. Record each visit and its source with an analytics script on every page.
2. Carry the visitor id into checkout. Dodo payment links get it automatically; checkout sessions take it as metadata.
3. Add a Dodo webhook endpoint for `payment.succeeded` and `refund.succeeded`.
4. Each payment is matched to the visitor, and your attribution model picks which of their visits gets the credit.

## Why Dodo Payments alone can't tell you where customers came from

Dodo knows the payment: the product, the amount and its tax, the customer and their email, the subscription it belongs to and the checkout session it came from. It also keeps metadata, up to 50 key-value pairs on a payment, a subscription or a checkout session, and sends it in webhook payloads ([Dodo: metadata (Dodo Payments documentation, opens in a new tab)](https://docs.dodopayments.com/api-reference/metadata)).

What Dodo can't see is the visit before the checkout. If a customer read your post on Reddit, came back two days later through Google and clicked the same buy button, the payment looks the same either way. The referrer, the landing page and the earlier visits live in your website analytics, which has never seen the payment. Joining the two needs an id both sides share, and metadata is where it goes.

## Step 1: Track website visitors and their sources

Add the SuprAnalytics script to the `<head>` of every page ([installation guides](https://supranalytics.app/docs/installation.md)). Each visit then records its referrer, its UTM tags, its landing page and a visitor id kept in a first-party cookie for a year. A visit with no referrer and no tags counts as Direct. The [tracking parameters guide](https://supranalytics.app/docs/tracking-parameters.md) lists the tags it reads, and the [Stripe guide](https://supranalytics.app/blog/how-to-track-stripe-revenue-by-traffic-source) explains sources and sessions in more depth; it all applies to Dodo too.

## Step 2: Carry the visitor into Dodo checkout

### Payment links: nothing to add

A Dodo payment link looks like `https://checkout.dodopayments.com/buy/pdt_…`. Dodo reads query parameters on it, and any parameter that starts with `metadata_` becomes a custom metadata field on the payment ([Dodo: payment links (Dodo Payments documentation, opens in a new tab)](https://docs.dodopayments.com/developer-resources/integration-guide)). When a visitor clicks such a link, the SuprAnalytics script adds two of them before the browser follows it: `metadata_supr_visitor_id` with their visitor id, and `metadata_supr_session_id` with the id of the visit they're in.

What the script does to a payment link when it's clicked

```
<a href="https://checkout.dodopayments.com/buy/pdt_123">Buy now</a>
<!-- clicked: https://checkout.dodopayments.com/buy/pdt_123?metadata_supr_visitor_id=6f1c…&metadata_supr_session_id=a83d… -->
```

- The ids are set at the click, so links added to the page later are covered too.
- The visit's id comes along, so the payment is credited to the exact visit the link was clicked in.
- A link that already has `metadata_supr_visitor_id` is left alone.
- To stop the script changing Dodo links, add `supr-dodo="false"` to the SuprAnalytics script tag. It applies to every link on the page.
- Only links on checkout.dodopayments.com whose path starts with `/buy/` are changed.

### Checkout sessions: pass the id as metadata

If your server creates the checkout session, read the `supr_visitor_id` cookie from the request and put it in the session's metadata. `supr_session_id` is optional and credits the payment to that exact visit. The payment the session produces carries the metadata, and the webhook brings it back.

Node.js, from the SuprAnalytics Dodo Payments guide

```
import DodoPayments from "dodopayments";

const dodo = new DodoPayments({ bearerToken: process.env.DODO_PAYMENTS_API_KEY });

const session = await dodo.checkoutSessions.create({
  product_cart: [{ product_id: "pdt_123", quantity: 1 }],
  return_url: "https://yourdomain.com/thanks",
  metadata: {
    supr_visitor_id: req.cookies.supr_visitor_id,
    supr_session_id: req.cookies.supr_session_id,
  },
});
res.redirect(303, session.checkout_url);
```

Runs on your server; the API key never goes in browser code. `req.cookies` is Express with cookie-parser. The rest of the setup is in the [Dodo Payments guide](https://supranalytics.app/docs/dodo.md).

SuprAnalytics reads the payment's metadata first and the customer's metadata after it, so a visitor id you keep on the Dodo customer works as well.

### When there's no id: customer id and email

A payment without a visitor id still counts. SuprAnalytics then looks for the Dodo customer id on an earlier payment that was matched, then a visitor with the same email, known from an earlier payment or from the [identify call](https://supranalytics.app/docs/user-identification.md) your app makes at sign-up. If nothing matches, the payment is revenue without a source.

What breaks the connection

- **Another device or browser.** A phone and a laptop are two visitors.
- **Blocked tracking.** Ad blockers can stop visits being recorded. [Serving the script from your own domain](https://supranalytics.app/docs/proxy-guide.md) helps.
- **Cookieless mode.** A visitor is recognised for one day (UTC), so only same-day payments are attributed ([cookieless tracking](https://supranalytics.app/docs/cookieless-tracking.md)).
- **A link opened elsewhere.** A payment link sent by email and opened without a visit to your site has no visitor id to add.

## Step 3: Connect the Dodo Payments webhook

The connection is one webhook endpoint per website and its signing key. There's no API key to share, and past payments aren't imported: SuprAnalytics records payments from the moment the webhook is set up.

1. Copy your webhook URL

   In SuprAnalytics, open the website's **Settings → Revenue**, pick Dodo Payments, and copy the URL. It looks like `https://supranalytics.app/api/webhooks/dodo/YOUR_WEBSITE_ID`.
2. Add an endpoint in Dodo

   In the Dodo Payments dashboard, open **Developer → Webhooks** and click **Add endpoint**. Paste the URL ([Dodo: webhooks (Dodo Payments documentation, opens in a new tab)](https://docs.dodopayments.com/developer-resources/webhooks)).
3. Select two events

   Select `payment.succeeded` and `refund.succeeded`.
4. Paste the signing key

   Copy the endpoint's signing key, which starts with `whsec_`, into Settings → Revenue with Dodo Payments selected, and click Connect.

| Dodo event | What SuprAnalytics does |
| --- | --- |
| `payment.succeeded` | What SuprAnalytics does: Records the payment. Dodo sends it for one-time payments and for every subscription charge, alongside `subscription.renewed` on renewals ([Dodo: subscriptions (Dodo Payments documentation, opens in a new tab)](https://docs.dodopayments.com/developer-resources/subscription-integration-guide)). Payments that aren't succeeded, payment-method updates and free payments are skipped. |
| `refund.succeeded` | What SuprAnalytics does: Marks the payment refunded, or lowers its amount for a partial refund ([Dodo: webhook events (Dodo Payments documentation, opens in a new tab)](https://docs.dodopayments.com/developer-resources/webhooks/intents/webhook-events-guide)). |

### What happens on every delivery

- **Signature check.** Dodo follows the Standard Webhooks specification and signs each delivery with the `webhook-id`, `webhook-timestamp` and `webhook-signature` headers. SuprAnalytics checks the signature against your signing key and refuses a timestamp more than 5 minutes off. A wrong key is answered with 401 "Invalid signature" and nothing is recorded.
- **Retries.** Dodo makes up to 8 attempts in all: one at once, then retries after 5 seconds, 5 minutes, 30 minutes, 2 hours, 5 hours, 10 hours and 10 hours. Any answer other than 2xx counts as a failure.
- **Duplicates.** Each payment is stored once, and each refund is applied once by its id, so a delivery that arrives twice doesn't count twice.

## Step 4: Test in Dodo's test mode

Dodo has a [test mode (Dodo Payments documentation, opens in a new tab)](https://docs.dodopayments.com/miscellaneous/test-mode-vs-live-mode) with its own API keys, products and webhooks, where no money moves. Test there; never make a real purchase just to test attribution.

Use a separate website for testing

Each website keeps one Dodo signing key, and payments can't be deleted, so test payments sent to your real website stay in its revenue. Add a second website for your staging site, with its own script and webhook URL, and point the test-mode webhook at it.

1. In test mode, add an endpoint for the test website's URL with the two events, and paste its signing key into that website's Settings → Revenue.
2. Open your staging site in a fresh window with a tagged link, such as `?utm_source=test&utm_medium=email&utm_campaign=attribution_check`.
3. Click your payment link (or start your checkout session) and pay with a test card, such as 4242 4242 4242 4242.
4. In Dodo, open the endpoint's delivery logs. The payment's delivery should show status 200; where the response is shown, look for `"attributed": true`.
5. In SuprAnalytics, the payment appears in the visitor's journey and the Campaign report credits `attribution_check`.

The response SuprAnalytics sends Dodo for a recorded, matched payment

```
{
  "received": true,
  "result": { "visitorId": "…", "attributed": true, "duplicate": false }
}
```

`"attributed": false` means the payment was recorded without a source: check that the checkout carried the visitor id. A retried delivery answers `"duplicate": true`.

When it works, add an endpoint in live mode for your real website, with its own signing key.

Revenue by referrer, with payments from several providers combined.

## What Dodo Payments revenue SuprAnalytics counts

| Payment | How it's counted |
| --- | --- |
| Amount | How it's counted: The payment's `total_amount` less its `tax`: after discounts, before tax. Dodo's `total_amount` is the amount charged including tax ([Dodo: the payment object (Dodo Payments documentation, opens in a new tab)](https://docs.dodopayments.com/api-reference/payments/get-payments-1)), and Dodo is the merchant of record that remits it ([Dodo: merchant of record (Dodo Payments documentation, opens in a new tab)](https://docs.dodopayments.com/features/mor-introduction)), so tax isn't your revenue. Amounts are converted from the currency's smallest unit, zero- and three-decimal currencies included, and payments in other currencies are converted to your website's currency with daily rates. |
| First payment | How it's counted: A one-time payment, or a subscription's first charge through a checkout session. Counts toward new customers, conversion rate and revenue. |
| Renewal | How it's counted: A subscription charge that didn't come through a checkout session, or a later charge of a subscription SuprAnalytics has already recorded. Revenue, but not a new customer. Credited to the same visitor through the payment's or customer's metadata, or the Dodo customer id of an earlier matched payment. |
| Payment-method update | How it's counted: Skipped: it isn't a sale. |
| Free payment | How it's counted: Skipped: there's no revenue to attribute. |
| Full refund | How it's counted: Marks the payment refunded; it drops out of revenue. |
| Partial refund | How it's counted: Lowers the payment by its pre-tax share. Dodo refunds include tax ([Dodo: refunds (Dodo Payments documentation, opens in a new tab)](https://docs.dodopayments.com/features/transactions/refunds)), so a $29.50 refund of a $59 payment with $10 of tax lowers its $49 by $24.50, to $24.50. Each refund is applied once; a refund that arrives before its payment is applied when the payment's delivery lists it. |

So SuprAnalytics totals won't match Dodo figures that include tax. Payment tracking also isn't subscription analytics: SuprAnalytics doesn't calculate MRR, ARR or churn. What it adds is where paying and renewing customers came from ([subscription revenue](https://supranalytics.app/features/subscription-revenue)).

## First touch or last touch?

Each payment keeps two visits: the visitor's first visit ever and their last visit before paying. **Last touch** is the default and credits the visit that converted, even a direct one. With a tagged payment link, that is the visit the link was clicked in. **First touch** credits the visit that brought them in. Change it in **Settings → Revenue → Attribution model**; the switch re-credits past payments too. The [first-touch vs last-touch guide](https://supranalytics.app/blog/first-touch-vs-last-touch-attribution) works through examples.

## Common Dodo Payments attribution problems

| Problem | Likely cause and fix |
| --- | --- |
| No Dodo payments show up | Likely cause and fix: Open the endpoint's delivery logs in Dodo. 400 "Dodo Payments is not configured for this website" means no signing key is saved for that website; 401 "Invalid signature" means the key belongs to another endpoint, or test mode and live mode are mixed up. |
| Payments have no source | Likely cause and fix: The checkout carried no visitor id. Check that the script runs on the page with the payment link, or that your server passes the metadata, and identify signed-in users before checkout. |
| A payment link isn't tagged | Likely cause and fix: It already has `metadata_supr_visitor_id`, the script tag carries `supr-dodo="false"`, the link isn't a checkout.dodopayments.com/buy/ link, or the click happened before the script loaded. |
| Too much Direct revenue | Likely cause and fix: Untagged links, apps that drop the referrer, or last touch crediting direct returns. Tag the links you share, or compare with first touch. |
| Revenue lower than in Dodo | Likely cause and fix: SuprAnalytics counts the amount before tax, lowers partial refunds by their pre-tax share and skips free payments. |

More on this: [Dodo Payments revenue attribution](https://supranalytics.app/integrations/dodo-payments) · [Dodo Payments setup guide](https://supranalytics.app/docs/dodo.md) · [Renewals and refunds](https://supranalytics.app/docs/renewals-refunds.md) · [How revenue attribution works](https://supranalytics.app/revenue-attribution) · [Pricing](https://supranalytics.app/pricing)

## Frequently asked questions

### Can Dodo Payments show where my customers came from?

Not on its own. Dodo records the payment, the customer and their email, and any metadata you attach. It doesn't see the visits before checkout, so it can't tell you that a customer first found you through a search last week.

### Do Dodo payment links need any code for attribution?

No. With the SuprAnalytics script on the page, a click on a checkout.dodopayments.com/buy/ link adds metadata_supr_visitor_id and metadata_supr_session_id to it. Dodo keeps metadata_* parameters as the payment's metadata, and the webhook brings them back. Checkout sessions your server creates need the visitor id passed as metadata.

### Which Dodo Payments webhook events do I need?

payment.succeeded and refund.succeeded, sent to your website's webhook URL. payment.succeeded arrives for one-time payments and for every subscription charge, so renewals need no extra event.

### Does SuprAnalytics count tax in Dodo revenue?

No. Dodo's total_amount includes tax, so SuprAnalytics takes the payment's tax off and counts the rest: after discounts, before tax. Dodo is the merchant of record and remits the tax. Totals can differ from Dodo figures that include tax.

### Are Dodo subscription renewals tracked?

Yes. A subscription charge that didn't come through a checkout session, or a later charge of a subscription SuprAnalytics has already recorded, is a renewal. It is credited to the same visitor through the payment's or customer's metadata, or the Dodo customer id of an earlier payment. Renewals don't count as new customers. This is payment tracking, not MRR or churn.

### How are Dodo refunds handled?

Each refund.succeeded is applied once, by its refund id. A full refund marks the payment refunded and it drops out of revenue. A partial refund lowers the payment by its pre-tax share: Dodo refunds include tax, so SuprAnalytics takes off the refund times the payment's pre-tax part over its total.

### Can I import past Dodo payments?

No. SuprAnalytics records payments from the moment the webhook is set up. Earlier payments stay in Dodo.

### Why do some Dodo payments have no traffic source?

They couldn't be matched to a recorded visit: the checkout carried no visitor id, the customer paid from a link opened outside your site, an ad blocker hid the visits, or cookieless mode saw a later day as a new visitor. They still count in your total revenue, without a source.

## More articles

[All articles](https://supranalytics.app/blog)

- [Guide · 22 min readBest Analytics Tools for SaaS in 2026Compare the best SaaS analytics tools for website traffic, product usage, conversions, subscriptions, and revenue attribution. Find the right fit for your SaaS.Read](https://supranalytics.app/blog/best-analytics-for-saas)
- [Comparison · 18 min readBest Google Analytics Alternatives With Revenue Tracking in 2026Compare Google Analytics alternatives for revenue tracking, Stripe payments, conversions, and attribution. Find the right analytics tool for your business.Read](https://supranalytics.app/blog/google-analytics-alternatives-with-revenue-tracking)
- [Comparison · 4 min readBest Privacy-Friendly Website Analytics Tools in 2026Compare privacy-friendly website analytics tools by cookies, visitor tracking, hosting, features, and pricing. Find the right alternative to Google Analytics.Read](https://supranalytics.app/blog/best-privacy-friendly-analytics)
- [How-to · 17 min readHow to Track Stripe Revenue by Traffic SourceLearn how to connect Stripe payments to website traffic sources, UTM campaigns, and visitor journeys. Understand attribution, webhooks, renewals, and refunds.Read](https://supranalytics.app/blog/how-to-track-stripe-revenue-by-traffic-source)
- [How-to · 10 min readHow to Track Polar Revenue by Traffic SourceConnect Polar.sh payments to the traffic sources, UTM campaigns and visits behind them: checkout links, the Checkout API, webhooks, renewals and refunds.Read](https://supranalytics.app/blog/how-to-track-polar-revenue-by-traffic-source)
- [How-to · 11 min readHow to Track Paddle Revenue by Traffic SourceConnect Paddle Billing payments to the traffic sources, UTM campaigns and visits behind them: checkout buttons, Paddle.js, webhooks, renewals and refunds.Read](https://supranalytics.app/blog/how-to-track-paddle-revenue-by-traffic-source)
- [How-to · 13 min readHow to Track Lemon Squeezy Revenue by Traffic Source (and Keep It When You Migrate)Credit Lemon Squeezy orders to traffic sources until it stops taking payments on 31 March 2027, and keep that history when you move to another provider.Read](https://supranalytics.app/blog/how-to-track-lemon-squeezy-revenue-by-traffic-source)
- [How-to · 13 min readHow to Track ChatGPT Referral TrafficLearn how to identify ChatGPT referral traffic, track AI visitors and conversions, and understand why some AI-driven visits appear as Direct.Read](https://supranalytics.app/blog/how-to-track-chatgpt-referral-traffic)
- [How-to · 15 min readHow to Track Conversions Without Google Analytics 4Learn how to track website conversions without GA4, including button clicks, form submissions, signups, purchases, and conversion funnels.Read](https://supranalytics.app/blog/how-to-track-conversions-without-ga4)
- [Explainer · 13 min readFirst-Touch vs Last-Touch Attribution: What's the Difference?Understand first-touch vs last-touch attribution with real-world examples. Learn how each model credits traffic sources, conversions, and revenue.Read](https://supranalytics.app/blog/first-touch-vs-last-touch-attribution)

---

This page on the web: https://supranalytics.app/blog/how-to-track-dodo-payments-revenue-by-traffic-source
More of SuprAnalytics for AI agents: https://supranalytics.app/llms.txt
