How to Track Affiliate Link Clicks with Google Analytics and Tag Manager

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
- In this video, we're gonna learn how you can track your affiliate links on your website with the help of Google Tag Manager and Google Analytics. Hi there, and welcome to another video of measureschool.com where we teach you the data driven way of digital marketing. My name is Julian. So, today we're gonna talk about affiliate links and how we can track those with Google Analytics and Google Tag Manager. It's actually pretty easy, I have an example here on this website. I have affiliate product, that when you click on this button will lead you to amazon.com and we hopefully get our affiliate commission once the user buys this product. Now, we won't be able to track the actual Buy on Amazon.com. In this case DE, but we will be able to track whether the user click this button. In any interaction that the user actually takes on our page can be tracked with Google Tag Manager and Google Analytics and for an affiliate site, this click would be the ultimate goal to actually track within Google Analytics. So, how would we go about this? Now, the first thing that we would do is actually look at the link that this click points to. We can see it here in the bottom left corner or if you want at little bit more visual, I'll go here on the Inspect Element and, oh, where can we see it? Set this again. Right here we see the "a href" and this is the link that this button points to and the user will be directed to. Now, there's actually a short link so when you actually click it, it expands and shows the full URL but this can be ignored for now. We just need to be able to recognize the uniqueness about this link because if you have other affiliate products, we don't wanna go through and track them individually, we actually wanna install one tracking with Google Tag Manager that tracks all of our affiliate links. And if you ever worked with Amazon affiliate links before, you know that this amzn.to is pretty unique to this Amazon affiliate links, at least the short links could also be amazon.com and you would have these longer links here, but the amzn.to should do for now. We just gonna remember this and install our tracking with Google Tag Manager. So, let's head over to Google Tag Manager and we'll start out by generating a click trigger. So, let's go over to Triggers and click on New here and this will be our Click Trigger for now. We're just gonna name this pretty generic because we're gonna change it later. And as the Event, we're gonna choose to Click and specifically, in the second step you wanna look at Just Links because this is actually link as we seen in the HTML marker. So, let's click on Just Links and let's keep these options checked off for now, we're gonna get back to them later. Let's continue and let's click on All Links for now and create this trigger. So far, pretty easy. And we're gonna do now is going to our preview and debug mode which we can do under the Publish button which will put our browser and only our browser into a special mode that will deploy our tags and our triggers only on our browser. So, we can head back to our page and reload our page here. And we see, we get a little preview and debug console that gives us more information about what is being deployed by Google Tag Manager. For now, I have a Google Analytics page view tag that I'm ready to deploy. Now, we wanna see what happens when I click on this Buy product link and I will do this with the command key press, so it actually opens up in a new tab and keeps this site loaded. So, we do this with the command key pressed and I clicked and we see a event down here called the gtmlinkClick. Once we click on this gtmlinkClick, you see that nothing fired on this event but we know that this interaction is actually now being picked up by Google Tag Manager and we can further work with it. So, if this doesn't get picked up in your Google Tag Manager account, you might need to change up your HTML console custom listener. Next thing we can do is actually check the variables. Now, the variables don't tell us too much right now because we haven't yet activated our Auto Event Variables, we would need to do that in our Variables here and we see here, Built-in Variables and here's also a special click variable and the one that I'm interested in is the actual Click Target so the URL that the user is pointed to but we can also activate all the other ones so we get a full information here. So, let's refresh our preview and debug mode, very important and go back to our page, let's close these and reload our page. Alright, and I'm gonna click the Buy product button again with the command key pressed. We get the event again and under Variables, I now have all the variables I have defined beforehand and we see what gets filled and may not get filled. In our case, the interesting part, I thought was the Click Target but this doesn't get filled because of the markup of the page, and what gets filled is the actual Click URL that features our URL with the amzn.to which is pretty unique to our affiliate links, and therefore, we wanna use this Click URL to filter down our trigger and later our tag to only fire when a user clicks on this amzn.to link. Now, this might be different for your affiliate links, maybe Click ID gets filled and you just need to make sure that you have a unique point that you can base your filter of your trigger in order to target the right links on your page. So, we'll go with this amzn.to, just gonna copy this head back over to Google Tag Manager and go back to our Triggers and let's first of all, click in here and rename our trigger, this will fire on a click event and specific to amzn.to links also called affiliate links. Alright, now in the second option, if you want to, you can choose Wait for Links and Check Validation. This will actually listen back to the side and see if the user has actually clicked this link and he will successfully redirected on. This can be particularly interesting because if the user list the site, which he doesn't now in our case, Google Tag Manager will delay the redirecting for two seconds and be able to fire our event tag that we want to deploy via Google Tag Manager. So, this is quite useful for out case. So, let's continue here, and then, there's a new option that pops up which will ask us, when do we actually want to listen for this clicks, and in our case, we want to listen for it on all pages so we can just go ahead and click on Page URL, contains then our domain, in our case, demoshop.com. So then listen to all the pages out there that are tracked. Let's continue and here we will now use our knowledge from our Variables to filter down our trigger. So, we go with some clicks here and choose the right variable that we just saw in the preview and debug mode, in our case, that would be click URL which should contain amzn.to. Now, you can be all fancy with this and use RegEx as well. We have a tutorial on this as well that you can check out but in our case, we just had Amazon links on our different products and they should contain amzn.to. So, this is when I want to Fire On Event into Google Analytics and track our affiliate click. Let's save this trigger and let's connect it to our tag. For that we go over to tag and click on New, you will notice, I have already a page with tag. This is the normal Google Analytics tracking that normal sites have installed and we'll add another GA tracking, this time, it will be Event Tracking and this is specific to our Affiliate Links. As a product, we go of course with Google Analytics, we have Universal Analytics running on our page and the tracking ID is already saved in a variable called GoogleAnalyticsid. If you wanna look at it up how to store in such a variable, then check out our video on Google Analytics on constant variables. And as a track type, we'll choose Event. Now, Events has different properties here that we need to fill especially Category and Action and our Category should always be Affiliate Links, and then the action could be click for example but we wanna get more relevant information actually about what link was actually clicked. So, in our case, I want to know the actual link that was clicked so I will go with Click URL and this will simply take our URL and input it here as an action and then, we'll go with label and this is actually one bucket beneath the Action and the Category so you can use that also to fill in useful information although it's optional. In our case, I want to know on which web page did this click actually happen. So, I will go with Page Path. Now, for the Configuration is the Non-Interaction Hit which is important if you don't wanna affect your bounce rate, set it to True. Now, in our case, the interactions on the page which I want to count towards the bounce rate so I keep this on fault. Let's continue here and connect this all to our trigger in the first step which we already prepared and just choose this, save and create this tag. Let's Refresh our preview and debug mode and go back to our page. Let's refresh this as well. Close this tab. And I click on this Buy product button again with the command key pressed. And you see that we have our new event, the gtmlinkClick, once we click on it, we see which tags have fired upon this link click and we can even look at this link click and see why this trigger has turned true because our Click URL had amzn.to in it, and what information was our Event Action, Category and Label filled with, and these were dynamically filled with the URL that this link points to what the user has left to. The category which we have to find beforehand which was Affiliate Links and the Event Label. Now, to check this all, we can also go into Google Analytics into the actual Real Time Reporting and on the Events, we should see our events coming in as somebody clicks on such and affiliate link. So, we see up here our Affiliate Links, Event Action and the Event Label. So, this works as expected and is now ready for testing so we could also do a negative test and click on another link that isn't an affiliate link, so for example, down here we have an email link or on the home page, I think, demo links here, there's an Outbound Link Click, this is an outbound link. I'll click this again with the command key pressed, you get a gtmlinkClick, but this time, the event didn't fire and nothing was transferred to Google Tag Manager because of how we set up the filter. So, this works as expected and is now ready for deployment. So, we can go into our Google Tag Manager, actually turn off our preview and debug mode. And then publish this as a version to all our users that visits our page. So, we'll not only be deployed on our browser but now on all the browsers. You can again do a little test here, go back to our affiliate product and click on the Buy product button, we have redirected on and now in our real time reporting, we should see a new event with our affiliate link clicked. Now, you can also see the data later in the Behavior and Event Report where you then have access to all the affiliate links that were pressed on your website. Now, this will take a while to populate, so you can check back after a day and we'll probably have a lot of different affiliate links clicked depending on how many users you have on your website who clicked on affiliate links, and of course, if these clicks are the main goal of your website, I would recommend to also set this up as a goal for your website. So, you can go here to New Goal, choose a custom variation here, should be our Affiliate Click, choose the ID slot and as type, you would choose Event, and simply the Category would need to be whatever we filled in as a Category, Affiliate Links. And we can save that and we would also have this saved on our reports as a goal and we could, for example, look how many people from a given source have clicked on our affiliate links. So, that's already it with this week's video of measureschool.com. If you liked this video, please give us a thumbs up and subscribe to our channel, and if you wanna check out more events that you can check with the help of Google Tag Manager, then head over to our event tracking course under measureschool.com/eventracking. We will show you how to track more interactions that the user can take on your website with the help of Google Tag Manager. My name is Julian, 'til next time. (upbeat music)
Info
Channel: MeasureSchool
Views: 37,937
Rating: 4.868041 out of 5
Keywords: Google Tag Manager, Affiliate Tracking, Link Tracking, Button Tracking, Outbound links, Referral Link tracking, Affiliate link tracking, Google Tag Manager course, JavaScript, Content, Content Grouping, Wordpress, julianjuenemann, jjanalytics, tracking, measure, data, gtmtraining12, internet marketing, digital analytics, analytics, Marketing
Id: PXONXfZQfFo
Channel Id: undefined
Length: 15min 9sec (909 seconds)
Published: Fri Jul 08 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.