How to Use Redirects to Track Links,Downloads & More

How to Use Redirects to Track Links


Tracking email links, downloads, and others outbound resources accurately can be challenging. In this video, I show you how you do all these with a combination of redirects Google Tag Manager and Google Analytics.

Free Email course: https://old.measureschool.com/emailcourse
Free Resource Library: https://old.measureschool.com/resources
More Measure Courses: https://old.measureschool.com/products

?Looking to kick-start your data journey? Hire us: https://old.measureschool.com/services/

RECOMMENDED MEASURE BOOKS: https://kit.com/Measureschool/recommended-measure-books

GEAR WE USED TO PRODUCE THIS VIDEO: https://kit.com/Measureschool/measureschool-youtube-gear

– In this video I’m gonna show you how you can track links, downloads, and other outside sources more precisely with the help of a tracking redirect which we will install with Google tag manager. So let’s dive in. 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 and in this video we’re gonna talk about how we can track our external clicks and downloads more accurately. I have an email here that I sent to myself, and sometimes you get these emails where there’s a link to an outside resource, like this PDF, and there’s actually no way for Google Analytics to pick this up because we can’t install Google Tag Manager or Google Analytics inside of a PDF. We can only install it on webpages that actually can communicate back to Google analytics. And also in our tool, like our email tool, we can’t install any kind of Javascript codes. So how can we circumvent that? The one suggestion I have here is through a redirect. So for example, when I click this link, I first go to my page, and I’m being redirected to the resource so in that step in between Google Analytics can pick up an event that then can be seen in Google Analytics as a download event and the resource that we redirected to. So this is a neat way to actually see if your user actually clicked on or viewed your resource. So how can we install this with the help of Google Tag Manager and Google Analytics? First of all, went ahead and built a page that shows a little bit of a graphic which you can leave out if you want to. It just signalizes that the user needs to wait until he’s redirected. Now on this page there is no Javascript, no redirect just yet, all the magic happens actually in Google Tag Manager. Let’s go over to Google Tag Manager and right now in this account that I just opened up we just have a Google Analytics page you tag installed and now we want to install our redirect method. Now the first step is to actually import our tag template which you can also do on the measureschool.com/redirecttemplate and all you need to do is click on import and get the jason file and import it to your account. It will be one tag, one trigger, and actually two more variables installed but they are also some built in variables that will be activated on your account. So let’s do this and now you should see in the variable menu two new variables, the redirect variable and the redirect parameter variable. Now let me explain quickly what those are. The redirect parameter variable just looks into the URL and sees if there’s a query string in there called redirect. And this is the key word that we need to use in our query string. So for example, on our download page we would have a query string called redirect and then afterwards we would have our URL that we want to send the user on to. In this case for example, Google.com Now if you click that, and reload the page, nothing happens quite yet because we still need to install our tag which calls the second variable that we have installed the redirect variable. And this is the actual variable that will redirect your user on to the page that we have defined in the redirect parameter. Now there is also a time out of one second installed just so we can actually see what is happening in the browser but you can remove that if you don’t want to actually show this download screen to your user and it would just redirect the user on right away. So what will we do with these two variables? Simply we’ll just build an event in Google Analytics with a bit of a twist? So let’s go ahead and create a new tag. This will be our GA tag which will track downloads and be fired on a redirect. We’ll choose our product which is Google Analytics, and then our tag type which is Universal Analytics, and we select our tracking ID which I have already saved up in a variable. Next step is to choose the track type which in our case is an event, and we can give it a category, our case download. We could also call it redirect or whatever you want. And in the action I will put in the actual the redirect parameter which we’ll send the user on to to get his resource. The other ones we leave free for now. The important thing is to choose as the non interaction hit true so it doesn’t affect the bounce rate. And now the magic happens. We will implement a hit call back under the more settings you can choose field to set and add a field. Now we’ll choose the hit call back to call a function once Google Analytics request was sent successfully. And the function that we want to actually call is our redirect variable. Now what will this do? Again if the Google Analytics event hit is successful it will call this redirect variable and send the user on. That’s very important because we don’t want to send the user on to the next page too early. We only want to send them on once the user has been actually tracked in Google Analytics. So we built in this call back in order to ensure that the redirect doesn’t happen before the actual event hit. Now we can go ahead and continue this. And just define a new firing trigger which I will define as redirect and it will fire on the DOM Ready event and not on all pages but only on pages where our redirect parameter is actually defined so we’ll just go with does not equal undefined. Okay great, now we are ready to go. Let’s create this trigger. And create this tag. So let’s try this out in our preview in debug mode. Back to our download page. We already have here a redirect installed and if we reload this page should now be redirected onto Google.com which happens. Now let’s go into our Google Analytics and we see that there’s an event that just fired where we had a download that was redirected onto Google.com. So it all works as expected and we can go ahead and publish this as a version to all our users. Now in order to use this correctly, you can actually just take any side of your website and simply attach a query string with the redirect parameter and tell your user where he should be redirected on to. So for example, in our case, can redirect them on to our resource guide. User comes to the page and then is redirected. And we see all this in Google Analytics as well. It’s why I told you, you don’t really need the download page, but it’s just a little bit nicer for the user to see what is happening while he’s waiting. And this is how you can install a redirect method on your website in order to track certain downloads that come from outside sources, like an email newsletter, or an external website, that you actually have control over. In order to decorate the link with the redirect parameter. It’s also a great technique if you want to track links in your email newsletter that go to outside sources. For example, you redirect on and you recommend somebody, and you want to track that link through a redirect method. But you could also use it on your website itself. If you prefer this method over the methods that I’ve shown you previously where you can actually track the button click directly. And that’s already it with this week’s video of measureschool.com If you want to download the variables and tags that I’ve just explained to you then head over to measureschool.com/redirecttemplate and install those directly into your account without having to type out the actual code in your variables. And if you like this video, Please subscribe to our channel, because there is more to come every week. My name is Julian. Until next time.