How to Easily Track & Categorize File Downloads in Google Analytics with Google Tag Manager

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right here we're going to cover how to track downloads on your website but not only that how to automatically categorize your downloads by file type so if you have a website where you want users to access documents or files downloads this is how you can track those downloads using google tag manager so that your data comes into google analytics you'll need a google analytics account so you can find the data under behavior in the left navigation and then drilling down to events and top events this is where we'll send the download data so if we go to google tag manager where we'll configure the tags there are a couple steps that we'll need to do in gtm here so what we'll do is configure the the tag the event tag the trigger which will provide the conditions upon which the event tag will fire and configure the variables so first we will configure the variables make sure that we have the right variable set up and in general for your google tag manager you will want to have all the variables all the built-in variables under pages event clicks all the all the variables and the clicks are good to have but we'll really just use the click url there as well as forms we won't use these but these are good to have as well and if you want video tracking scroll tracking those are good to have as well so we have our variables now we'll go to configure the tag so in this window here we'll click on new and then label it ga event file download downloads tag and then click on tag configuration for universal analytics event and in category we're going to type downloads the event action we're going to create a new custom variable so you can do that either by clicking on this lego icon and clicking the plus here or you can type double brackets and then scroll down and click new variable so for this variable is going to be a url variable and we'll call it file extension variable so we'll click on variable configuration choose url and then in the drop down for component type select file extension so we can take a look at the more settings and the url source will be the page url that's what we want format value you can take a look at these settings here to see if you want to change the value according to your preferences for us we're going to change the case to all lowercase so all the values that are passed into this variable will be turned into lowercase and then we'll save this variable so when the event tag fires and captures the file extension from the url it'll pass that value into the event action and then for label we are going to use the click url and then we scroll down and then configure the google analytics settings if you have a ga settings variable already configured i would suggest you use that if not click on enable override settings in this tag and then input your ga ua id so that's this this value right here this tracking id okay so since we already have the ga ua settings variable configured that's what we're going to use make sure i uncheck that and then we'll configure the trigger so what we're going to do is create a new trigger and we'll call it a link click file download trigger click on the trigger configuration and then select just links some clicks and what we're going to do is click wait for tags so what this setting does it delays the opening of links until all the tags have fired so we want to make sure that our event tag fires so we're going to enable this setting and we'll just leave it at 2000 milliseconds so we want this trigger to be enabled when all of these conditions are true and we're just going to set this to page url matches regex and input a period asterisk regex is short for regular expression and this regex here with the dot and the asterisk it's looking for any character with the dot and then with the asterisk zero or more of that character so for all the page urls this trigger is going to check if there are any values that meet this criteria so if that's true if it does meet the condition then the trigger will be enabled and then if we go down here fire this trigger when an event occurs and all of these conditions are true for this drop down we're going to choose click url and then we're going to select matches regex and we'll paste the regex in this field here and this will look for click urls that have these file name extensions and that includes pdfs excel spreadsheets word documents powerpoints odt files zip files routerfiles.txt files and so forth now these question marks here are looking for zero or one of the previous characters so for excel files for example is looking for either dot xls or dot xls x extensions so either one of those will pass this condition so let's save this trigger and take a look at the configuration for this event tag so downloads for the event category the url file extension for event action and then for the event label the actual file download so the event action is what will automatically charact categorize each download according to file type so let's save this we'll click on preview allow this window to load and you have to grab your website url that you want to test so this is what we're going to test and we'll click on connect we'll wait for this to load and tag assistant tells us that our preview mode is connected so we'll click on this page here where i've set up a couple download links so we have this pdf download up here and then another pdf down here so let's try clicking on the first pdf link so this is what happens this is the file that comes through if we go to our tag assistant tab let's click on continue and we can see that all these texts have fired including our ga event file download so we can click on that and these are all the values that are included with this tag and what we can do is click on this 14 link click which corresponds to what's shown on the left side here so that's the 14th event and then we can see that all the conditions for the trigger have been met so that's why the event tag fired and what we can do is in the upper right corner here select the values radio button and this will give us the actual values so for category event category it gives us downloads that's what we that's what we set so the event actions should say pdf instead of html but let's look at our event label okay the event label here it does give us the correct file download so you can see here the the file extension is a pdf so instead of html it should be pdf so what we're going to do is go back to gtm and change the variable for file extension and under more settings we're going to change the url source to click url instead of the page url because the page url will just give us the the page you the url of the page that we're already on but instead we want the click url okay so we'll save that variable so let's preview and test this again so that's the website url that we want click connect wait for it to load okay we're connected with tag assistant and then we'll click on the page with the then download links we'll click on this download okay it's loaded now we'll go back to our tag assistant preview tab and check to see that our file download event tag is fired we'll go to the click the link click that corresponds with this tag and make sure that the radio button is set to values and then click on show more so event category downloads that's what we want event action which should be the file type that's what we want and then the event label the actual url of the file download so everything checks out here but let's go back to the other download link so if we click on that it's also another pdf file let's go back here click on summary and it should actually be the last link click so because that was the last action that we took so we can just click on 15 link click and we see on that action the event file download tag fire so we can click on that we can check our values by clicking show more downloads again pdf and the actual download file url so we look good here and we'll just click out of that now let's go to google analytics and look at our real time data so in the left navigation click on real time overview under events and click on oh let's make sure we're in the right account how about that so digital sandbox website that's the one we've been using and there it is our download events so if we click on events in the last 30 minutes so we can see here that's the that's number two the second row is the one we were first testing but the first row shows us our successful download tracking with two events here under pdf so if we click into that into the downloads category we can see each of the file downloads that we have now if we go back up and we click on pdf we can see the the ones that tracked correctly and there they are both of the pdf files that we have so these tags are good to go so you can go back to your gtm tab and whenever you feel like is a good time to publish this dtm container with the tag the trigger and the variables that we've configured just click on submit you can name this version file download tracking add a description here we'll say tracking file downloads by file type and then click on publish when you're ready now we have file downloads tracking configured and published to our container so next we will cover reporting for file downloads setting up a report in data studio and setting up a report in ga4 so if you want to see those videos subscribe to the channel and we'll see you in the next one
Info
Channel: Growth Learner
Views: 615
Rating: undefined out of 5
Keywords: Google Analytics, Web Analytics, Digital Analytics, web analyst, digital analyst, digital marketing, digital marketer, User behavior, user engagement, metrics reporting, reports, digital measurement, download tracking, Google Tag Manager, GTM
Id: OLl8RuieQkc
Channel Id: undefined
Length: 17min 37sec (1057 seconds)
Published: Mon Sep 13 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.