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

JavaScriptby ReferlyIntegration

What arrives in Referly

Referrals trackedSales tracked

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.

Referrals trackedSales tracked

What it does

  • YesA signup, trial or new customer is recorded against the partner who sent them, before any money moves.
  • YesEvery completed payment arrives as a sale with its amount, products and currency, and a commission is calculated from it.
  • YesAn `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 conditionA renewal is tracked when your own code reports it as a second sale. Nothing polls the platform for you.
  • NoNothing is polled from a platform, so a refund is reversed by your own code or by a teammate in the dashboard.
  • NoA customer who types a partner's discount code at checkout is attributed to that partner, with no link click and no cookie involved.
  • NoReferly creates the discount code inside your platform when a partner joins, so you never mint codes by hand.
  • NoReferly reads your product catalogue, so a rule can pay one rate on one product and a different rate on another.
  • NoTarget a whole collection instead of listing its products one by one, and new products in that collection inherit the rate.
  • With a conditionTax is deducted when your call reports a tax amount.
  • NoShipping is subtracted before the commission is calculated. On by default, and switchable.
  • NoInstead of cash, a partner's balance can be issued as credit inside the platform they already shop in.
  • With a conditionSomeone has to add the tracking snippet to your site once.
  • NoThere is nothing to authorise. The snippet does the work.
  • NoPartners 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.
  • NoMoney actually leaves through this platform. Referly hands it the batch, and it moves the funds to each partner.
  • NoOne 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. 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. 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. 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. 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.

Read the JavaScript setup docs

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.

OptimizePress
SaaSSite builder

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

James Dyson

Founder & CEO, OptimizePress

7 figures
in affiliate-driven sales
4,554
active affiliates
10,536
referrals
Letterly
Mobile appAI writing

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

Ilfat Khayrullin

CMO & Co-founder, Letterly

300K+
app users
689
active affiliates
24,114
clicks tracked
Moov
EcommerceFitness

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

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.