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
Copy your tag
Open Tracking in the sidebar and copy the tag under Script tag. It loads from your product's affiliate subdomain:
<script src="https://affiliates.yourapp.com/track.js" async></script>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.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.
Affiliate links
An affiliate link is a page of your site with ?via= and the affiliate's code:
https://yourapp.com/pricing?via=sarahAffiliates 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.
The referral cookie
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.
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.
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.
Cookie consent
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.