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.

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.