Skip to main content
Connect your payment provider to see which marketing channels drive revenue, not just traffic.

Why revenue attribution?

Revenue attribution helps you:
  • See ROI - Understand which campaigns drive revenue, not just traffic
  • Optimize spend - Focus your marketing budget on channels that convert
  • Measure success - Track revenue by source, campaign, and keyword
  • Make data-driven decisions - Use revenue data to guide your marketing strategy

How it works

  1. Track visitors - PostMetric tracks all visitors to your site
  2. Record payments - When a payment is completed, it’s recorded in PostMetric
  3. Link payments to visitors - Payments are linked to visitors using:
    • Visitor/session IDs (most reliable)
    • Email matching (if user identification is enabled)
    • Timestamp correlation (fallback)
  4. View revenue data - See revenue by source, campaign, and more in your dashboard

Setup methods

Webhooks automatically send payment data to PostMetric when a payment is completed. This is the most reliable method.

Stripe

Set up Stripe webhooks

LemonSqueezy

Set up LemonSqueezy webhooks

Method 2: API

Record payments manually using our API. This is useful for custom payment providers or server-side implementations. See our Payment API documentation for details.

Linking payments to visitors

You don’t need a backend PostMetric integration. Get visitor identification on the client and pass it into your payment flow (e.g. Stripe metadata). Use the PostMetric script’s methods (same values as in cookies):
// When creating a checkout or payment (e.g. before redirecting to Stripe)
const visitorId = window.postMetric?.getVisitorId?.();
const sessionId = window.postMetric?.getSessionId?.();

// Pass to your backend or into Stripe metadata
const session = await stripe.checkout.sessions.create({
  // ... payment config
  metadata: {
    websiteId: "your-website-id",
    visitorId: visitorId,
    sessionId: sessionId,
  },
});

Option 2: Client cookies

PostMetric sets cookies that you can read from your own code:
  • Visitor ID: cookie _pm_vid
  • Session ID: cookie _pm_sid
Read these on the client before starting checkout and include them in payment metadata (e.g. Stripe metadata.visitorId, metadata.sessionId). Also include websiteId in metadata so the webhook can attribute the payment to your site.

View revenue data

Once payments are linked, you can view:
  • Revenue over time - See revenue trends
  • Revenue by source - Which channels drive the most revenue
  • Revenue by campaign - Campaign performance
  • Conversion rates - Revenue per visitor by source
  • Average order value - AOV by source

Next steps

Stripe integration

Detailed Stripe setup guide

LemonSqueezy integration

Detailed LemonSqueezy setup guide