The two halves of an integration
Almost every setup is a pair, and the halves are independent. You can mix a JavaScript front end with an API back end, or a Shopify front end with a Shopify back end.1
Attribution — identify the affiliate
The browser-side tracker records the click and hands you a click ID. That ID is what you attach to the eventual purchase.
2
Conversion — report the sale
A payment webhook, a plugin, an automation platform, or a direct API call tells Referly that a purchase happened and which click ID it belongs to.
How the click ID is produced
The tracker script goes in thehead of every page you want attributed:
?ref=CODE by default), the tracker registers a click and exposes two globals:
localStorage fallback when cookies are unavailable, so it survives navigation and subdomain hops. See install the snippet and attribution for the full behaviour.
Payment provider connections
You authorise Referly against your payment provider once. From then on Referly consumes that provider’s events directly, reads the real charged amount, and reverses commissions on refunds without you writing any reporting code.
Attribution reaches the provider through whichever identifier that provider carries end to end. For Stripe that is
client_reference_id on the Checkout Session, set to window.affiliateId:
client_reference_id to the link or embed for you, so there is nothing to wire up manually.
PayPal is a payout method in Referly, not a conversion source. Its webhook reports the status of money you send to affiliates, not sales you receive. See payout methods.
Stripe app
OAuth connection, click ID plumbing, and coupon sync.
Shopify app
App install, order webhooks, and theme tracking.
WooCommerce plugin
Plugin setup and the endpoints it calls.
Payment provider webhooks
Event coverage, verification, and replay behaviour.
Automation platforms
Zapier and Make are the escape hatch for tools Referly has no native connector for. Both authenticate with a Referly API key exchanged for an access token, then work in two directions:- Triggers subscribe to Referly events. The platform registers a webhook endpoint against your program and receives new affiliates, referrals, and sales as they happen.
- Actions write into Referly. The same create-affiliate, create-referral, and create-sale operations the REST API exposes, wrapped as no-code steps.
Zapier
Triggers, actions, and authentication.
Make
Modules, scenarios, and connection setup.
Custom and server-side
When nothing off the shelf fits, report conversions yourself. The REST API is the most flexible route and the one with the fewest moving parts between your billing logic and Referly. Sign-ups go to/api/v1/referrals:
/api/v1/sales, keyed to the referral you already created:
externalInvoiceId so retries are safely deduplicated — see idempotency.
The Universal integration sits one level below the API: the tracker plus a form-binding snippet that calls window.createPushLapEmail(email, name) on any form submit, turning sign-ups into referrals with no backend. It deliberately does not report sales, so pair it with the API or a payment connection when money is involved.
Universal integration
Form-based referral capture for any stack.
Postback URLs
Server-to-server callbacks for affiliates and networks.
Which direction the data flows
Two of the pages in this section are outbound rather than inbound, which is easy to miss:- Webhooks push Referly events to your endpoints. Program-level, signed, retried, and logged. See webhooks.
- Postback URLs push events to an affiliate’s endpoint. Each affiliate sets their own URL in the affiliate portal under Settings, then Advanced. Referly fires a
GETto it onreferral.createdandsale.created, substituting macros such as{clickid},{extClickid},{sale_amount}, and{commission_amount}into the URL. This is how media buyers and networks close the loop back into their own ad platforms.
Choosing an integration
Work down this list and stop at the first match:- Your provider has a native connection (Stripe, Shopify, Paddle, Chargebee, Polar, WooCommerce) — use it. Refunds, real charged amounts, and subscription lifecycle come free.
- You bill through something else but can fire an automation — use Zapier or Make.
- You have a backend and want control — use the REST API. Report referrals and sales yourself, with your own retry and idempotency semantics.
- You only need to know who referred a sign-up — the Universal integration is enough on its own.
The common setup flow
Whichever route you take, the shape is the same:1
Install the tracker
Add the script to your
head on every page in the funnel, including the landing pages affiliates link to. Skip this only for a coupon-only program.2
Connect or authenticate
Authorise the payment provider, install the plugin or app, or create an API key under Settings, then API keys. API keys require a Business plan.
3
Carry the click ID to checkout
Attach
window.affiliateId to whatever your provider carries end to end — client_reference_id for Stripe, metadata or cart attributes elsewhere. Hosted Stripe surfaces are handled automatically.4
Verify with a test conversion
Visit your site with
?ref= and a real affiliate code, complete a purchase in test mode, and confirm the sale appears against the right affiliate. Turn on debug mode to watch the tracker’s decisions in the console.Related
Quickstart
Get a first attributed sale end to end.
Server-side tracking
Report conversions from your backend.
Attribution
Windows, precedence, and how clicks resolve.
API authentication
Keys, bearer tokens, and scopes.