Track Affiliate links

Image of Iron Brands

Published on Feb 2, 2024 and edited on Feb 21, 2024 by Iron Brands

Affiliate marketing is all about getting the word out about a company's products or services. As an affiliate, you promote these items and earn a commission for any sales or traffic you bring in.

Keeping tabs on your affiliate links is super important. It helps you understand what's working and what's not.

Let's dive into this a bit more and see how you can track your affiliate links in a smart way.

  1. Why is tracking affiliate links important?
  2. How to use Simple Analytics tracking affiliate links
    1. Install the Script
    2. Add events on your form
    3. Test & Access Event Data
    4. Create Goals
  3. Conclusion
Logo of MichelinMichelin chose Simple AnalyticsJoin them

Affiliate link tracking presents data on page views, clicks, conversions, traffic, leads, referrals, and purchases generated by affiliates for your brand. This will let you discover how effectively the affiliate marketing approach is working for your business.

It helps in determining the performance of affiliates and the commissions they get for marketing your products or services. It also promotes transparency during the affiliate marketing process, allowing you to understand how the strategies are helping to grow sales and revenue, as well as help maximize the success of the campaigns.

Note: The below process only tracks campaign URLs of your own website/web property.

Install the Script

Start by creating your account on Simple Analytics (if you haven't done this already). This will prompt you to add your website and install the script onto your website.

This is really easy and works the same as if you would add Google Analytics to your websites. The script enables Simple Analytics to start tracking page views on your website.

Add events on your form

Affiliate links generally have a URL parameters like ?ref= or ?via=, to track these you’d need to trigger an event whenever these parameters are present in the URL.

For starters, here’s how the script should look like.

const searchParams = new URLSearchParams(;





Test & Access Event Data

Now that you have started collecting affiliate links, head over to your website’s Simple Analytics dashboard.

Then click on the events tab, and you should be able to see all your events there, including the ones you added.

Events dashboard

Create Goals

Next is the final and most important step, and that is start visualizing your metrics using our “goals” feature.

To effectively measure affiliate link clicks, create the goals based on the event triggered:

  • Define the goal: Give it a name like “Affiliate Traffic
  • Set the event: Choose the event “aff_link
  • Mark the goal as important: Ensure it appears in the visitor dashboard for easy tracking.

Affiliate Traffic GoalBy creating the goal, you can monitor traffic from affiliate links with ease.


Affiliate link tracking boosts performance, optimises conversion rates, and prevents fraud. There are various platforms that can help you track the links; but with Simple Analytics its very easy.

At Simple Analytics we believe in an independent internet that is friendly to website visitors. If this resonates with you, feel free to give us a try!

GA4 is complex. Try Simple Analytics

GA4 is like sitting in an airplane cockpit without a pilot license

Start 14-day trial