How To Track Affiliate Links in Google Tag Manager

Do you know what pages are converting the most on your affiliate site?

Unlike conventional E-Commerce shops, Affiliate marketing is the process of selling or pitching other people’s products or services and receiving a commission for it.

Affiliate Earnings In December
Amazon Associates – Affiliate Commissions In December

One of the things that a lot of new affiliate site owners want to do is learn how to set up affiliate link tracking in Google Analytics.

While you can’t set it up directly in Analytics, Google Tag Manager can be setup to track affiliate link clicks and send the data to Google Analytics.

If you haven’t set up Google Analytics in Google Tag Manager, or set up Tag Manager at all, do that first, which is a prerequisite of tracking affiliate links using Google Tag Manger here.

Here’s how to set up Affiliate Link Clicks With Google Tag Manager.

1. Create A Click Trigger

2. Name The Trigger

Click on “Choose a trigger type to begin setup”

From the “choose trigger type” menu, select Just Links from the Click section.

In Trigger Configuration, Make sure you have “Wait for tags” and “Check Validation” UN-checked. For now, make sure that “All Link Clicks” is also selected.

Now Click Save in the upper right.

You will need to rename the trigger, so call it “Affiliate Link Tracking” or similar.

Your trigger is now setup, and your dashboard should look like this

3 Create The Click Variable

Click on the Variables Menu Item on the left side, and you should see this screen

4 Enable the Click Built In Variable

Click the red Configure button at the top of the Built-in Variables box

From the slide out menu of selectable items, click the four indicated in the “Clicks” section in the image below

Just click in the greyed out area to on the left. This will save the configuration.

5. Add The Link To Track In Your Trigger

Now you want to return to the Triggers by clicking on the triggers menu on the left (green arrow), then click on the trigger you created in step 1 and 2 (red arrow)

The trigger configuration box should pop up, so hover your mouse over the box and a pencil icon should appear in the upper right of the box. Click on that pencil icon to edit the trigger.

Rename the trigger to a more meaningful name. In my case, since I am tracking the Amazon Affiliate links that have a url that has AMZN.TO/affiliate-link-code-here, I will track any link that has the domain, AMZN.TO.

Now click the two check boxes, Wait for tags and Check Validation.

When you click the Wait for tags checkbox, you will see a new line open up directly below. Make sure the first dropdown box is Page URL, the second has contains and the third has your site’s domain name (eg: since I’m doing this for, I would type in “” in that third box without the http://, https:// or the www.

Next, you’ll see that I’ve now selected “Some Link Clicks” in the picture above. This is so that we are only tracking the links I tell it to track, and not every single link on the site that people click on.

Amazon Associates uses two different kinds of links. One is a long link, and the other is a shortened link.

Long Link Example:

  • Amazon short link URL example:

In the image below, you can see that you have a choice of short or long links. You will want to use the Short Link for tracking purposes if you’re following along with this article on how to track affiliate links in the Google Tag Manager.

If you are using, then your “license plate short link” as they call it looks like this:

  • ShareASale short link URL example:

One both of the new trigger configuration lines are customized, then click the save button in the upper right.

The trigger is now fully setup, and it’s time to connect it to a new tag that we’re going to create!

6. Connect the Trigger To A New Tag

Click on the “TAGS” link on the left to get to the tags screen.

You will see the tag for when we set up the Google Analytics tracking in the tag manager. (If you missed this blog post, stop here and setup Google Analytics in your Tag Manager now).

Create a tag name for this tag.

When you create the name, you will want to easily identify what this tag is for. Create a name that is something like EVENT TRACKING – AMZN LINKS so you know that this tag is to track the event when someone clicks an Amazon link.

7. Setup the Tag to pass the click tracking to Google Analytics

Now we want to make sure that we can track the link clicks in Google Analytics.

Click the Choose a tag type to begin setup… link (green arrow) on the left, then Universal Analytics (red arrow) on the right in the Choose tag type menu.

The screen that pops up looks pretty simple at first.

Change Track Type dropdown to EVENT.

Now you see a bunch of other boxes appear.

Fear not, Here’s what you need to do:

  • Category: Give the category a name, like “affilate links” or similar.
  • Action: select or type {{Click URL}}
  • Label select or type {{Page Path}}
  • Value select or type {{Click Text}}
  • Non-Interaction Hit select False
  • Google Analytics Settings select your analytics settings. It could be {{Universal Analytics}} or {{Analytics}}

8. Define When To Trigger The Tag

Now scroll down, and click on the “Choose a trigger to make this tag fire…” link

When you click on the link, a slide out menu comes up that says Choose a trigger.

Select the trigger you just made above called “Affiliate Link Tracking” or whatever you named it in the above instructions.

Once selected, you”ll see this screen:

Make sure to click save at this point.

Click save until you are at the Tags dashboard:

You will see the new Affiliate Links tag in the list.

10 Click The Submit Button to Begin Tracking Your Affiliate Links

11. Publish And Create Version in Google Tag Manager

Finally, you just need to give this version a name (green arrow). This is just a title of what you did. In our case, it can be as simple as initial affiliate link tracking creation or so.

You may add a description to help you remember exactly what was done as well.

Finally, FINALLY, Click publish button to finalize the tracking.

At this point, your affiliate link clicks are going to be tracked moving forward, but it might take a day or two for you to see the results in Google Analytics.

How To View Your Affiliate Link Clicks In Google Analytics

Setting up the link tracking was the boring, hard part. Now seeing what pages are getting the most link clicks, and what links are most trafficked is the fun part.

It should be mentioned that Google Analytics will not track the affiliate link click all the way through the purchase on Amazon, ShareASale, etc. because you can’t add your tracking code to those sites, but you will at least see the activity on your site, and what is working.

Keep in mind, you might not see the tracking show up in Google Analytics for a day or two.

Open Up Google Analytics

On the left menu, click on the Behavior menu link to expand the menu.

Now click on Events then Pages.

This brings up the pages where your affiliate links have been clicked on in order from most clicks to least clicks.

To see both the page and the link that was clicked, Click on secondary dimension, You’ll see a drop down where there’s a search bar. Type “Event Action” into the search, then click on the box to activate the secondary view.

You will now see a second column with the Amazon / ShareASale / Etc. links.

In the first column, you will find the page that the link clicked happened on. Then in the second column, you will see the link that was actually clicked.


Just having this kind of data is really helpful in letting you know what pages are really working for you. Seeing the links that are clicked also is nice. You can over time, get a feel for what people are buying, especially when you take a look at the Amazon Associate’s dashboard.

Keep in mind that this doesn’t indicate whether the person actually bought the affiliate product or not. There’s no way to join the data in that way with Amazon or ShareASale.

For reporting purposes, there’s a lot more that can be done with the event tracking of affiliate links in Google Analytics, but for now, this is a good start in gathering data on your affiliate click throughs.

Leave your vote

6127 points
Upvote Downvote

Total votes: 3

Upvotes: 3

Upvotes percentage: 100.000000%

Downvotes: 0

Downvotes percentage: 0.000000%

Leave a Reply

Your email address will not be published. Required fields are marked *