Track Conversions
Report leads and sales from your server, or let Stripe and Shopify send payment events to Refport automatically.
After click tracking is installed, report the events that matter to your referral program. Refport uses the click ID to connect those events back to the partner link.
Conversion flow
| Event | When to send it | Recommended path |
|---|---|---|
| Lead | A referred visitor signs up or becomes qualified | Better Auth plugin or track.lead() |
| Sale | A referred customer completes payment | Stripe, Shopify, or track.sale() |
| Refund | A tracked payment is refunded | Stripe or Shopify integration |
Lead tracking
If your app uses Better Auth, install the plugin and let Refport track sign-ups automatically.
Better Auth
Automatic lead tracking for Better Auth sign-ups
Manual lead tracking
Call track.lead() from any server-side auth flow
The manual pattern is always the same:
- Read the
refp_idcookie from the incoming request. - If there is no click ID, skip tracking.
- Call
track.lead()after the user is created. - Never let tracking errors block sign-up.
Sale tracking
Use an integration when your sales happen in Stripe or Shopify. This keeps payment attribution, recurring revenue, and refunds aligned with the source of truth.
Stripe
Attribute Checkout, invoices, subscriptions, trials, and refunds
Shopify
Attribute paid orders through the Shopify app and storefront embed
Manual sales
Call track.sale() from your own server-side payment flow
Minimal server SDK setup
npm install refportimport { Refport } from "refport";
export const refport = new Refport({
apiKey: process.env.REFPORT_API_KEY!,
});Keep REFPORT_API_KEY on the server. Never expose it in browser code.
Where the portal fits
Conversion tracking powers the embedded portal. Once leads and sales are flowing, partners can see clicks, conversions, earnings, and payouts directly inside your product.