1
Create an API key
In your dashboard, open Developers → API keys
(referralful.com/dashboard/developers)
and create one. The secret is shown once. See Authentication for how to
send it.
2
Add the tracking snippet
Drop this into the Find your exact snippet in Dashboard → Settings → Tracking snippet.
<head> of every page on your site. It records referral clicks and
exposes the referral id as window.AffID.referral:Separate app subdomain? If your marketing site is
yourbrand.com and your app or
checkout is on app.yourbrand.com, add the snippet to both. The referral cookie is
stored on your registrable domain (.yourbrand.com), so it is shared across every
subdomain automatically — but each page that starts checkout needs the snippet loaded so
window.AffID.referral is available there.3
Attribute the sale
Tell Referralful which affiliate to credit when a customer pays.
- Stripe
- Any other billing (no Stripe)
Pass the captured referral as Conversions and recurring commissions track automatically from Stripe.
client_reference_id on the Checkout Session:4
Add affiliates
Let people join through your signup page, or create them via the API:The response includes the affiliate’s
links (their tracking tokens) to share.5
Verify it works
Make a test purchase through an affiliate link, then read the data back:You should see a referral move to
conversion and a commission appear.Make sure conversions actually track
The snippet tracking clicks is only half of it — these are the things that most often cause “clicks track but conversions don’t”:Cover every checkout path
Cover every checkout path
If customers can start a subscription from more than one place — onboarding, a
pricing page, an in-app “upgrade” modal — set
client_reference_id in all of
them. Miss one and sales from that path won’t attribute.Read the referral at checkout time, not page load
Read the referral at checkout time, not page load
window.AffID.referral is available as soon as the tracking script has loaded.
Read it at the moment you create the Checkout Session, not from a value
captured on first render that might still be empty if the user clicked quickly.It goes on the Session, not the customer
It goes on the Session, not the customer
client_reference_id must be on the Checkout Session. Putting the referral
in customer metadata or on the Subscription won’t work — Referralful doesn’t
read those.Verify it in Stripe
Verify it in Stripe
Open the Checkout Session in the Stripe Dashboard —
client_reference_id should
show your referral id. If it’s empty, the referral never reached checkout (fix the
integration); if it’s set but no commission appears, check that the customer paid
(a $0 trial doesn’t create a commission until the first real charge).Free trials
A trial subscription is handled automatically — you don’t configure anything extra:- At signup: the referral is recorded as a conversion and the customer is linked to the affiliate. No commission yet (no money moved).
- At the first real charge (trial end): the commission is created for the affiliate, based on the amount actually charged.
- If they cancel during the trial: no charge, no commission.
client_reference_id once at checkout — Referralful handles the
trial → paid transition. In your dashboard, trial subscribers show under Trials
until they’re charged, then move to Conversions.
