EarnedStats Docs

Revenue

Revenue overview

Connect your payment provider and every sale is tied to the visit behind it.

EarnedStats takes payments from your provider by webhook, links each one to the visitor who paid, and credits the source of that visitor's first visit.

Pass the visitor id at checkout

This is what makes attribution exact. The script adds it to checkout links for Stripe payment links, Polar, Dodo Payments and Lemon Squeezy by itself, and to Shopify carts and WooCommerce checkout forms. For checkouts your server creates, send it from the browser:

checkout.js
// In the browser, with the request that starts the checkout
const { es_visitor_id } = window.earnedstats?.attribution?.() ?? {};
await fetch('/api/checkout', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ es_visitor_id }),
});

Then set it as metadata on the checkout. Each provider page shows where.

When the id is missing

A payment is still linked when the buyer lands back on your site after paying, when their email matches a visitor you identified, when it renews an earlier payment, or when exactly one visitor clicked a checkout link shortly before. The payment's Journey tab shows how it was matched.

Past payments

Sales from before you connected a webhook can be imported. Open your provider in Settings, Revenue, paste a read only API key (or the credentials it names) under Import past payments, and EarnedStats reads your payment history in batches. Stripe, Paddle, Razorpay, Shopify, WooCommerce, Dodo Payments and Polar return the visitor id with each payment, so past sales are credited to their visits. Lemon Squeezy, Freemius and Creem return no visitor id, so their past sales are matched by customer and timing. Importing twice never counts a payment twice.

Providers

Coming next: Whop, Superwall, App Store, Shopify App Store. Until then, use the server API.