Affiliates (for merchants)

Getting referrals

New referrals will be created whenever a customer visits an affiliate's unique link and then buys a product. This can happen on any of your store pages, but also from your own site if you use our small tracking script.

On your storefront or product pages

Default affiliate URLs shown to your affiliates point to your storefront, like this:

You can choose to change the default URL shown to your affiliates from Settings > Affiliates. To do this, change the "Affiliate referral URL" value to something like This will make your affiliates' sharing links appear like Make sure to read the "In your app" section below if you do this to make sure you track referrals properly.

Your affiliate code can also be appended to individual product URLs like this:

When a customer visits any of your Lemon Squeezy-hosted store pages with an affiliate code in the URL (?aff=1234), an anonymous unique identifier will be stored in our system. If they then buy one of your products before the identifier expires (which can be customized in your Affiliates settings), the order will be attributed to the affiliate and a referral will be created.

If a customer purchases a product after visiting multiple affiliates' links, you can choose in your settings whether the first or last affiliate is awarded the referral.

In your app

You can also generate referrals on any website by using our tracking script (3.5kB, served by our CDN).

You can copy the full script with the correct slug configured for your store from the affiliate settings page in Lemon Squeezy. Add the script to your site by pasting it into your head or body HTML.

Once the script is on your page, a visit to a page with the affiliate code in the URL (e.g. ?aff=1234) will create an anonymous unique identifier the same way as on your store pages.

This means you can have affiliates earn referrals by promoting your app, marketing site or individual pages.

As long as the tracking script is on the following pages, these are all valid referral links:


Then you just need to add links to your products on these pages. All links to your products where both the tracking script and the ?aff query parameter are present will be monitored and referrals will be created whenever someone clicks on them.

Advanced usage

While the tracking script handles updating outbound links and appends the required query parameters automatically, there might be rare cases when you create the checkout link directly.

In these situations, you'll need to add the ?aff_ref parameter to the URL manually.

Lemon.js has a special method to construct checkout URLs with tracking parameters included. Pass the checkout URL to the Build method, and it will give you back the URL with the affiliate tracking parameter added:

let url = '' url = LemonSqueezy.Url.Build(url) //

If you are building custom checkout URLs on the backend, you can pass the tracking ID to the backend and append it manually. To retrieve the tracking ID, you can use the GetId method.


Debug mode

If you want to verify that the tracking script has been properly integrated, debug mode can be activated in the configuration settings. When you enable the debug mode, the script will record the tracking activity in the browser console. This will help you see if clicks are being accurately captured.

Adding affiliates