How to Track Affiliate Links in Google Analytics (4 Steps)

Learn how to effectively track affiliate links in Google Analytics with our 4-step guide. Ensure accurate data and optimize your affiliate marketing strategy.
Image of author Nick Cotter

By Nick Cotter
Updated Jan 10, 2024

How to Track Affiliate Links in Google Analytics (4 Steps)
The content featured on this page includes products from our partners, who may provide compensation to us. This partnership can affect the selection and placement of products we discuss. Nonetheless, our assessments remain unbiased and are solely based on our independent judgments.
Table of contents

Looking to save time (and money from expensive link tracking software) to track your affiliate links in Google Analytics?

You’ve come to the right place.

Whether you’re an affiliate program manager or an affiliate marketer

I’m going to show you my way for tracking affiliate link clicks in Google Analytics 4..

It may not be the “best” method, but it’s worked well enough for me in the past and figured I’d also share it with you.

Let’s begin.

Featured
Image of Kademi logo
Kademi
Best Fit For: Global Channel Partner Management
Growann Rating ★★★★★

Prerequisites: Begin we Get Started on the Steps.

Before you start tracking affiliate links in Google Analytics, make sure you're ready.

Preparing properly not only makes things go smoother but also ensures accurate and useful data.

Here's a checklist of prerequisites:

a. Ensure you have a Google Analytics account set up.

Google Analytics signup page

One of the foundational steps to tracking any data on your website is having a Google Analytics account. If you haven't set one up yet, here's how:

  • Visit the Google Analytics website.
  • Click on 'Start for free' and follow the on-screen instructions. You'll need a Google account to sign in or create one if you don’t have one.
  • Once signed in, set up a "property" for your website and follow the given steps to install the tracking code onto your website. To integrate Google Analytics, you can add JavaScript code to your site's header. For WordPress, plugins are available to assist with seamless integration.

b. Ensure you have the right permissions to modify tracking.

Google Analytics 4 Admin Permissions page

Not everyone who has access to a Google Analytics account can make changes to its tracking. To avoid potential roadblocks later on:

  • Check your user permissions by navigating to the 'Admin' section of your Google Analytics account.
  • Under the relevant account and property columns, click 'User Management'.
  • Here, you can see the list of users and their permissions. Ensure you have "Edit" permissions. If not, you might need to contact the account administrator to grant you the necessary permissions or to make the changes for you.

c. Familiarity with affiliate link structure.

Affiliate links aren't just regular URLs; they contain specific parameters that identify you as the referrer. Understanding this structure will be crucial when setting up tracking:

  • An affiliate link is usually in this format: https://exampleproduct.com/?ref=YourAffiliateID.
  • In this link, the “?ref=YourAffiliateID” part is the parameter that credits you for any referral sale or action.
  • Different affiliate programs might have different URL structures. Familiarize yourself with the ones you're working with to ensure accurate tracking.

Once you have these requirements, you can easily keep track of your affiliate links and learn from your work.

4 Steps to Track Affiliate Links in Google Analytics

Tracking affiliate links may seem overwhelming, but it's simple with a step-by-step method.

Here’s a comprehensive guide to ensure that you can effectively monitor your affiliate link performance:

1. Generate UTM-Tagged URLs for Affiliate Links.

UTM (Urchin Tracking Module) parameters are specific text strings that you can attach to URLs. 

When users click on a URL with UTM parameters, those tags are sent back to Google Analytics for tracking.

Using Google’s URL Builder or other UTM tools:

Google Analytics UTM builder for Affiliates
  • Visit the Google URL Builder.
  • Fill in the fields, such as website URL, campaign source (e.g., newsletter or social media), medium (e.g., email), and campaign name (e.g., spring_sale).
  • The tool will generate a full URL with the UTM parameters. Copy this for use in your affiliate promotions.
  • Alternatively, there are several third-party tools and plugins that can also generate UTM-tagged URLs. Choose one that best fits your needs.

Tips for consistent naming conventions:

  • Be Descriptive but Concise: Ensure that the naming convention gives a clear idea about the link's origin and purpose without being too lengthy.
  • Use Dashes or Underscores: This makes parameters readable. For instance, use spring-sale instead of springsale.
  • Maintain Consistency: If you use “newsletter” as a source once, don’t change it to “email” next time.

2. (Attn: Affiliates) Implement UTM-Tagged URLs in your Affiliate Promotions.

Replacing regular URLs with UTM-tagged ones on your website, emails, social media, etc.:

Example of utm tagging on website
  • Whenever you promote an affiliate link, replace the standard URL with the UTM-tagged one.
  • This can be in the form of hyperlinks in blog posts, CTA buttons on your website, links in your email campaigns, or social media posts.

Ensuring proper link functionality:

  • Always test the UTM-tagged URLs before publishing. Click on them to ensure they lead to the right destination and that they look correct in the address bar.
  • Ensure that the affiliate ID, crucial for earning commissions, remains intact in the URL.

3. Set up Goals (Now Events) in Google Analytics.

i. Navigate to the Admin section of Google Analytics: Access your Google Analytics dashboard and go to the bottom-left section labeled 'Admin'.

Ga4 admin navigation

i. Navigate to the Events section in GA4: Access your GA4 property and, from the left menu, choose 'Events'.

GA4 custom events

ii. Marking an Event as a Conversion: Within the 'Events' list, you'll see various user interactions that GA4 tracks. If there’s a specific event that you consider a valuable action (like a completed purchase or sign-up), hover over that event and click on the star or 'Mark as conversion' option. This marks the event as a conversion.

4. Creating a Custom Report for Outbound Link Clicks in GA4.

Custom Outbound affiliate link click report

1. Ensure Outbound Link Clicks are Being Tracked as Events
Before you create a custom report, make sure outbound link clicks are being tracked. If you're using Google Tag Manager (GTM) with GA4, you can easily set up a tag to track these clicks as events.
If you've not already set this up:

  • In GTM, create a new tag of type 'GA4 Event'.
  • For triggering, choose 'Just Links' and further refine to track only links that go to external domains.
  • Name the event something descriptive like 'outbound_link_click'.
  • Once set up in GTM, you should start seeing this event in GA4 when users click on outbound links.

2. Access the GA4 Custom Report Builder

  • In your GA4 property, navigate to the 'Custom reports' option from the left-hand menu.
  • Click on '+ Create' to start crafting a new report.

3. Configure the Report for Outbound Link Clicks
a. Name Your Report: Give your report a relevant name, such as "Outbound Link Clicks Report."
b. Choose a Template: For outbound link clicks, the 'Flat table' template is a good choice as it allows for a straightforward view of events and related metrics.
c. Dimensions:

  • The primary dimension you'd likely want is 'Event name'. This will allow you to isolate the 'outbound_link_click' events (or whatever you've named them).
  • You might also want to add secondary dimensions like 'Source', 'Medium', or 'Page Path' to see where the clicks are coming from or on which page they occur.

4. Metrics:

  • Choose 'Event count' to see the total number of outbound link clicks.
  • You might also consider metrics like 'Engaged sessions' to see how often these clicks occur within engaged sessions.

5. Filters:

  • Apply a filter to ensure you're only viewing the desired event. Set the filter to show data where 'Event name' is 'outbound_link_click' (or whatever your event is named).

6. Visualize and Analyze

  • Once you've configured your dimensions, metrics, and filters, you can visualize the data in your custom report.
  • Check to see which pages have the highest number of outbound clicks or which sources are leading to the most outbound activity. Such insights can help inform your content and linking strategies.

7. Save and Share

  • If you're satisfied with the report's configuration, don't forget to save it. You can also share this custom report with other team members or stakeholders.

By meticulously following these steps, you'll be well-equipped to track and optimize your affiliate link strategies, ensuring that you get the maximum return on your promotional efforts.

Nick Cotter

Nick Cotter

Founder & CEO
Growann

With over 7 years navigating the intricate realms of marketing, and specifically B2B partner marketing, Nick has forged collaborations with top-tier tech brands, prominent agencies, and some of the industry's foremost B2B publishers and content creators. His deep immersion in both marketing landscapes showcases a trajectory of expertise and innovation. Identifying a significant void in specialized resources, he founded Growann.The aspiration? Deliver unparalleled insights and guidance, carving out a dedicated space where the broader marketing and B2B partner marketing communities can flourish.