JavaScript Affiliate Program Integration
Connect JavaScript once. Pay partners per sale.
Use frontend javascript to track signups and sales
14-day free trial · No credit card required · Cancel anytime
What arrives in Referly
4 steps to connect, 2 of which need someone technical.
Overview
Referly and JavaScript
Use frontend javascript to track signups and sales
Running more than one platform? They all feed one ledger, so partners get a single link, a single balance and a single payout.
What connects
What Referly tracks in JavaScript
Fourteen things, each one read from what JavaScript reports rather than from a feature list. The two chips below are the short answer.
What it does
- YesReferral tracking — A signup, trial or new customer is recorded against the partner who sent them, before any money moves.
- YesSale tracking — Every completed payment arrives as a sale with its amount, products and currency, and a commission is calculated from it.
- YesCarries your own click id — An `rsubID` on the inbound link travels all the way to the sale, so an ad platform or a network can match the conversion back to its own click.
What it does not, or only sometimes
- With a conditionRecurring commissions on renewalsA renewal is tracked when your own code reports it as a second sale. Nothing polls the platform for you.
- NoRefunds reverse the commissionNothing is polled from a platform, so a refund is reversed by your own code or by a teammate in the dashboard.
- NoCoupon-code attribution — A customer who types a partner's discount code at checkout is attributed to that partner, with no link click and no cookie involved.
- NoA discount code per partner — Referly creates the discount code inside your platform when a partner joins, so you never mint codes by hand.
- NoPer-product commission rules — Referly reads your product catalogue, so a rule can pay one rate on one product and a different rate on another.
- NoCollection-level rules — Target a whole collection instead of listing its products one by one, and new products in that collection inherit the rate.
- With a conditionCommission net of taxTax is deducted when your call reports a tax amount.
- NoCommission net of shipping — Shipping is subtracted before the commission is calculated. On by default, and switchable.
- NoPay partners in store credit — Instead of cash, a partner's balance can be issued as credit inside the platform they already shop in.
- With a conditionConnects without a developerSomeone has to add the tracking snippet to your site once.
- NoConnect from the dashboardThere is nothing to authorise. The snippet does the work.
- NoSyncs partners into a list — Partners are added to a named list or group in your email platform as they join, so onboarding and announcements go out from the tool you already write in.
- NoPays partners through it — Money actually leaves through this platform. Referly hands it the batch, and it moves the funds to each partner.
- NoPays everyone in one batch — One approval sends every partner what they are owed, rather than one transfer at a time.
Setup
Connect JavaScript in four steps
Four steps, in order. The honest note underneath says which of them need someone technical and what the connection does not do.
- 1
Add the tracking script to your site
One line in your head tag. It reads ref, via and aff from the URL and stores the click.
- 2
Report a referral when someone signs up
Call the referral function with the new user's email once your signup completes.
Needs a developer - 3
Report a sale when someone pays
Call the sale function with the amount and currency from your own success handler.
Needs a developer - 4
Set your commission and invite partners
Pick a rate, then send your first invites and watch the first calls land.
This is the developer route, and it is the one that works with anything. Because you make the calls, you also decide what a renewal is and when a sale is reversed, nothing is polled from a platform on your behalf. The click id is available on window.affiliateId as soon as the script resolves it.
Guides
Step-by-step for JavaScript
Written for the setup you actually have, not the one that makes the shortest article.
Customer stories
What a program on Referly looks like
Three businesses, three different stacks, and the numbers their partners produced.

“We have been running affiliate programs for over a decade, and ours is one of the biggest parts of how OptimizePress grows. Referly is the first platform where an operation with thousands of partners actually feels manageable, from recruiting new affiliates to tracking every sale they send.”

James Dyson
Founder & CEO, OptimizePress
- 7 figures
- in affiliate-driven sales
- 4,554
- active affiliates
- 10,536
- referrals

“This platform is quite simple and easy to use, and you can start attracting people to your affiliate program very quickly. A big plus is that the founder, Ayo, is super responsive.”

Ilfat Khayrullin
CMO & Co-founder, Letterly
- 300K+
- app users
- 689
- active affiliates
- 24,114
- clicks tracked
“Affiliates drive a serious share of our revenue across three countries. Since we moved to Referly everything runs from one place, tracking has been spot on, and our partners get paid without me chasing spreadsheets.”

Alexander Koppers
Affiliate Manager, Moov
$6.9M
in total affiliate-driven revenue
- 1,154
- active affiliates
- 19,017
- affiliate sales
- 1,240,030
- clicks tracked
FAQ
Before you connect anything
The questions founders ask in the first ten minutes.
14-day free trial · No credit card required · Cancel anytime
Referrals and sales, on any site, in any stack. You add one line to your head tag, then call the referral function at signup and the sale function at payment. Because you make the calls, anything your site knows about, Referly can record.
Related
Also connects to
Universal FormsThis is able to track sign ups / referrals from any form hosted on your website when it's submitted (This won't work if the form is in an Iframe)
See what it tracks
Brilliant DirectoriesConnect your Brilliant Directories directory to Referly
See what it tracks
BoomerangMeConnect your BoomerangMe business with Referly to track referrals and sales
See what it tracks