Tracking Affiliate Referrals from Custom Landing Pages
This tutorial walks you through creating custom affiliate-specific landing pages with compact, user-friendly URLs like mysite.com/doe
, while ensuring referrals are tracked through Lemon Squeezy.
How it works
We’ll create landing pages for each affiliate, and we’ll use the Lemon Squeezy tracking script to monitor tracking without relying on cookies.
Lemon Squeezy generates random affiliate codes like ZylBs
, resulting in URLs such as mysite.com/?aff=ZylBs
, so by creating custom URLs such as mysite.com/doe
, we make these referral links easier to remember and share.
Create landing pages
The first steps is to create a landing page for each affiliate on your website. These can be regular pages in your CMS or you could create targeted pages for each affiliate, showing their name, avatar and some custom content for each. This would create a much stronger connection to the visitors who come through an affiliate’s link, especially if they are a well-known person.
Each landing page will require a unique URL. For demonstration, we’ll use /doe
as our URL, but this can be adjusted to fit each affiliate’s name or social media handle for example.
Alternatively, you can set up blank pages that simply redirect traffic to your homepage, ensuring clicks are still tracked.
Retrieve affiliate codes
With your pages prepared, the next step is to collect the affiliate codes for each affiliate.
Head to the Affiliates page in your Lemon Squeezy dashboard, click on an affiliate and note their Affiliate URL. The code is the part after aff=
. You will need this in the next step.
Let’s say that the affiliate code for our example affiliate “doe” is 1234
.
Add the Lemon Squeezy tracking script
Next, add the Lemon Squeezy’s affiliate tracking script on their custom landing page along with some custom code to capture affiliate clicks. In our example, we are creating a custom landing page for “doe” with affiliate code of 1234
.
Here’s the basic script configuration, with a placeholder 1234
to represent the affiliate code you noted earlier:
Replace 1234
with your affiliate’s code.
If you want to redirect to your homepage after the tracking has happened, you can add an onTrack
handler, which fires after the tracking has taken place, like this:
And that’s it! Your landing pages are set to track affiliate clicks, providing your affiliates with straightforward, branded URLs to share with their audience.