Supaffi

Set up/Tracking script and links

Tracking script and links

Add one script tag so Supaffi can record clicks on affiliate links.

One script tag on your site records clicks on affiliate links and remembers the referral until the visitor buys.

Add the script

  1. Copy your tag

    Open Tracking in the sidebar and copy the tag under Script tag. It loads from your product's affiliate subdomain:

    Tracking script
    <script src="https://affiliates.yourapp.com/track.js" async></script>
  2. Paste it in the head of your pages

    Add it to the <head> of every page an affiliate link can land on. Do not defer or lazy-load it, and do not move it into a click handler.

  3. Check the site

    Back on Tracking, press Check the site again. The Script tile turns to Live.

Copy AI prompt next to the code copies instructions you can paste into a coding assistant to make the change for you.

The script is the same tag on every page. If you sell through Stripe Payment Links, buy buttons or pricing tables, it also needs to be on the pages that show them. See Payment Links and pricing tables.

An affiliate link is a page of your site with ?via= and the affiliate's code:

Affiliate link
https://yourapp.com/pricing?via=sarah

Affiliates get one link when they sign up, pointing at your website. They can add more links to other pages from their portal. Codes are lowercase letters, numbers and hyphens, and unique across your install.

  • Only live codes count. A renamed or deleted code stops working at once.
  • A code from another of your products is ignored.
  • Reloading the same link within 10 minutes in the same browser counts as one click. Anything else is a new click.
  • Each network address can record up to 30 new clicks every 10 minutes.

When a visitor opens a link with ?via=, the script records the click and stores a referral token in a first-party cookie on your site.

PropertyValue
Name__supaffi_referral
Lifetime90 days
Path/
SameSiteLax
SecureOn HTTPS pages

The token is also available on the page as window.supaffi.referralToken. Your checkout code reads the cookie and passes the token to Stripe. See Checkout Sessions.

Attribution

  • Last click wins. A new affiliate link replaces the previous referral, and the most recent affiliate gets the credit.
  • Time to buy. Each program sets how many days after the click a sale still counts, 60 by default. Supaffi checks it on its side when the sale comes in. The cookie lasts 90 days, so a longer window has no effect past 90.
  • Renewals. Once a subscription is referred, its renewals keep earning for the program's duration, whatever the time to buy.

First click, split credit, coupon-only attribution and tracking across unrelated domains are not supported. More in How Supaffi works.

Check that tracking works

The tiles at the top of the Tracking page show where things stand.

supaffi.yourserver.com/dashboard
Trackingaffiliates.yourapp.com
Script
Live
on yourapp.com
Clicks, 30 days
214
Last click
24 Oct
First sale
2 Oct
The Tracking page once the script is found and a referred sale came through.
TileWhat it tells you
ScriptLive when the script is on your home page, or a click came in during the past 7 days. Not found otherwise.
Clicks, 30 daysClicks recorded in the last 30 days.
Last clickThe date of the most recent click, or None yet.
First saleThe date the first sale carrying a referral arrived, or Not yet.

The check looks for the script on your home page only. If you put it on landing pages alone, the tile reads Not found until the first click arrives. When the first referred sale comes through, the Overview shows Tracking is working. To run the whole path yourself, see Test your setup.

The script sets a cookie on your visitors' browsers. Whether you need their consent first depends on where you and they are. Asking for it is up to you: Supaffi does not show a consent banner.