Before you start you need a Referly account with a program created, and at least one affiliate
in it (create one yourself from the dashboard — you can use your own email). Reporting sales
through the API also requires the Business plan.
1. Get your program ID
Your program ID identifies which program a click belongs to. It is safe to expose — it goes in a public script tag. In your dashboard, open your program and find the tracking script section. It shows a snippet with your program ID already filled in:2. Install the tracking script
Add the snippet to every page of your site, not just the landing page. The script needs to run wherever a referred visitor might land, and again wherever they convert.data-affiliate is how the script finds itself in the page, and
data-program-id tells it which program to record against. Omit either and the script exits
silently without tracking anything.
The script is deliberately lazy. If the URL has no referral parameter and the visitor has no stored
referral, it makes no network requests at all — so it costs nothing on your normal organic traffic.
3. Record your first click
Grab an affiliate’s referral link from your dashboard, or build one yourself. By default the referral parameter isref:
ref is only the default. Your program’s URL parameter is configurable — via, partner, aff,
and around forty others are supported. The script reads your program’s setting at runtime, so it
only reacts to the one parameter your program is configured for. See
URL parameters.ref is the affiliate’s code and clickId is the click Referly just created. If both are present,
attribution is working. Navigate to another page on your site and run it again — the values should
survive, because they are stored in a cookie (with localStorage as a fallback).
The click also appears in your dashboard under your program’s click data within a few seconds.
4. Read the referral from your own code
The script resolves attribution asynchronously, so readingwindow.affiliateRef at the top of your
bundle will usually give you null. Wait for the event instead:
Passing the referral into your own signup flow is what makes server-side reporting possible later —
your backend needs to know which affiliate to credit.
5. Record your first conversion
A click only becomes revenue when you tell Referly the visitor converted. Pick one of these three — you do not need more than one.- Integration (no code)
- From your server (recommended)
- From the browser
If you take payments through Stripe, Shopify, WooCommerce, Paddle, Chargebee, Polar, or PayPal,
connect the integration and Referly reports payments for you. This is the most reliable option
because it reads charges from the payment processor itself.
Browse integrations
Connect your payment platform and skip the conversion code entirely.
6. Confirm the sale landed
Open your dashboard and check, in order:1
The referral exists
The customer appears in your referred customers list, linked to the right affiliate.
2
The sale is attached
The sale shows against that referral with the amount you sent.
3
A commission was created
The affiliate has a new commission. Its status depends on your program’s approval and hold
settings — pending is normal and does not mean anything failed.
Troubleshooting
getPushLapAffiliateInfo is not defined
getPushLapAffiliateInfo is not defined
The script has not loaded. Check that the tag is present in the rendered HTML (not just your
source), that
data-affiliate is on the tag, and that nothing in your CSP blocks
www.referly.so. If you load it with async, the function will not exist until the script
arrives — call it from the affiliate_referral_ready listener instead of at page load.No click is created when I visit the referral link
No click is created when I visit the referral link
The most common cause is a parameter mismatch: your program is configured for a different URL
parameter than the one in your link. Check your program’s URL parameter setting and make sure the
link uses exactly that one. Also confirm the affiliate code is real and belongs to this program —
an unknown code produces no click.
Attribution disappears when the visitor moves between domains
Attribution disappears when the visitor moves between domains
Cookies do not cross domains. If your marketing site and your app are on different domains, the
script decorates outbound links with handoff parameters so attribution survives the jump, but the
script has to be installed on both ends. See
Cross-domain tracking.
createPushLapSale returns null
createPushLapSale returns null
There is no referral stored in the browser, so the helper deliberately does nothing. Confirm
getPushLapAffiliateInfo() returns a ref on the same page. This also happens when checkout is
hosted on a domain that never saw the referral — in that case report the sale from your server
instead.The API returns 401 or 403
The API returns 401 or 403
401 means the bearer token is missing or unrecognised — check for a stray space or a truncated
key. 403 with User does not have API access means the program is not on a plan that includes
the API. See Authentication.The API returns 429
The API returns 429
You have hit a rate limit. Sales are the strictest endpoint because each one triggers attribution
and commission calculation, so bulk backfills need to be paced. Wait and retry rather than
looping. See Rate limits.
I need to see what the script is actually doing
I need to see what the script is actually doing
The tracking script logs its decisions to the browser console, but only when debug logging is
turned on for your program. Enable it from your program settings, reload, and you will see each
step it takes. See Debug mode.
Related
Core concepts
How clicks, referrals, sales, commissions, and payouts relate.
JavaScript API reference
Every function, global, and event the tracking script exposes.
Reporting sales
The full server-side conversion flow, including refunds.
Webhooks
Get told when referrals, sales, and commissions change.