Revenue Attribution

Attribute revenue to traffic sources with first-touch and last-touch models.

Revenue Attribution

EngageTrack connects your revenue data to traffic sources, giving you a clear picture of which channels drive actual business results.

How It Works

  1. Visitor Identity — The SDK generates a persistent visitor ID (localStorage) and a session ID (sessionStorage) to track visitor sessions. Access them via window.engagetrack.getVisitorId() and window.engagetrack.getSessionId().
  2. Source Tracking — Every session records the traffic source (UTM parameters, referrer, direct)
  3. Revenue Events — When a purchase occurs, EngageTrack receives a webhook from your payment provider and links the payment to the originating session
  4. Attribution — Revenue is attributed to the original traffic source using a four-level priority chain (see Attribution Models below)

Payment Provider Webhooks

EngageTrack receives payment events directly from your provider via webhooks. Connect your provider in Site Settings → Revenue:

ProviderConnection Method
StripeAPI Key
Lemon SqueezyAPI Key + auto-webhook
PaddleAPI Key + auto-webhook
PolarAPI Key + auto-webhook

EngageTrack automatically registers the webhook on your provider during connection. No manual webhook setup is required.

Manual Revenue Tracking

For custom payment flows, use the JavaScript API:

engagetrack.trackPurchase("ORD-789", 149.99, "USD");
// signature: trackPurchase(orderId, revenue, currency)

Webhook Integration

For server-side revenue tracking (subscriptions, renewals), configure a webhook integration:

  1. Go to Site Settings → Revenue
  2. Select your payment provider (Stripe, Lemon Squeezy, Paddle, or Polar)
  3. Copy the webhook URL and add it to your provider's dashboard
  4. EngageTrack will match webhook events to visitors using the engagetrack_visitor_id in Stripe metadata
// Server-side: Add visitor ID to Stripe checkout
const session = await stripe.checkout.sessions.create({
	metadata: {
		engagetrack_visitor_id: visitorId, // from engagetrack.getVisitorId()
		engagetrack_session_id: sessionId, // from engagetrack.getSessionId()
	},
	// ...other options
});

Attribution Model

EngageTrack uses last-touch attribution based on the session data available at webhook time. When a payment webhook is received, the revenue is attributed to the traffic source of the most recent session associated with the visitor.

To ensure accurate attribution, pass the engagetrack_visitor_id and engagetrack_session_id as metadata in your payment provider's checkout flow (see the Webhook Integration section above). This allows EngageTrack to link the payment directly to the originating session and its traffic source.