{"id":115,"date":"2019-08-12T13:02:05","date_gmt":"2019-08-12T12:02:05","guid":{"rendered":"https:\/\/organicdigital.co\/blog\/?p=115"},"modified":"2024-01-18T22:34:33","modified_gmt":"2024-01-18T22:34:33","slug":"how-to-track-pdf-downloads-in-analytics-using-google-tag-manager","status":"publish","type":"post","link":"https:\/\/daveashworth.co\/blog\/how-to-track-pdf-downloads-in-analytics-using-google-tag-manager\/","title":{"rendered":"How To: Track PDF Downloads in Analytics Using Google Tag Manager"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/daveashworth.co\/blog\/how-to-track-pdf-downloads-in-analytics-using-google-tag-manager\/#Why_Set_Up_PDF_Tracking\" >Why Set Up PDF Tracking?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/daveashworth.co\/blog\/how-to-track-pdf-downloads-in-analytics-using-google-tag-manager\/#Configure_built-in_variables_for_Clicks\" >Configure built-in variables for Clicks<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/daveashworth.co\/blog\/how-to-track-pdf-downloads-in-analytics-using-google-tag-manager\/#Create_Custom_Variable_For_Account_ID\" >Create Custom Variable For Account ID<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/daveashworth.co\/blog\/how-to-track-pdf-downloads-in-analytics-using-google-tag-manager\/#Create_A_Tag_To_Track_An_Event\" >Create A Tag To Track An Event<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/daveashworth.co\/blog\/how-to-track-pdf-downloads-in-analytics-using-google-tag-manager\/#Create_A_Trigger_Based_On_Link_Clicks\" >Create A Trigger Based On Link Clicks<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/daveashworth.co\/blog\/how-to-track-pdf-downloads-in-analytics-using-google-tag-manager\/#Test_in_Preview_Mode\" >Test in Preview Mode<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/daveashworth.co\/blog\/how-to-track-pdf-downloads-in-analytics-using-google-tag-manager\/#Publish\" >Publish<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Why_Set_Up_PDF_Tracking\"><\/span>Why Set Up PDF Tracking?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Most websites have resources which can be downloaded, and in\nmost cases, website owners and\/or marketing teams want to know which are being\ndownloaded and how often \u2013 particularly if these are part of a marketing\ncampaign or similar.&nbsp;&nbsp; However, by\ndefault, most websites don\u2019t allow you track downloads by default.<\/p>\n\n\n\n<p>Plugins may be available to assist with this, or you can ask your developers to add this functionality, or you can do it yourself if <a href=\"https:\/\/daveashworth.co\/skills\/google-tag-manager-consultant\/\">Google Tag Manager is installed on your site<\/a>.\u00a0\u00a0 <\/p>\n\n\n\n<p>This guide assumes that it is, and if it\u2019s not then you <a href=\"https:\/\/support.google.com\/tagmanager\/answer\/6103696?hl=en\" target=\"_blank\" rel=\"noopener\">ought to get it installed<\/a> because once you do it gives you control over a whole range of advanced website tracking and extended site functionality configurations.<\/p>\n\n\n\n<p>When you\u2019re ready, follow these steps:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Configure_built-in_variables_for_Clicks\"><\/span>Configure built-in variables for Clicks<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Built-in variables are available for many of the most commonly used tag and trigger configurations which allow you to interrogate the data layer based on user activity.&nbsp;&nbsp; In this case, you can elicit data based on what a user clicks on a page as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"196\" height=\"296\" src=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/click-variables.png\" alt=\"Click Variables\" class=\"wp-image-117\" srcset=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/click-variables.png 196w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/click-variables-99x150.png 99w\" sizes=\"(max-width: 196px) 100vw, 196px\" \/><\/figure>\n\n\n\n<p>This allows you to create triggers based on anything the\nuser clicks on, beyond just links, and then use the data from that element to\ntrack the activity via a tag.<\/p>\n\n\n\n<p>By default, these variables are not available, so click on \u201cVariables\u201d on the left hand GTM menu, then scroll through and tick the required variables you may as well click all of them whilst your here).&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Create_Custom_Variable_For_Account_ID\"><\/span>Create Custom Variable For Account ID<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This step is optional but would always recommend you create a custom variable to store your <a href=\"https:\/\/daveashworth.co\/skills\/analytics-and-ad-tracking-consultant\/google-analytics-4\/\">Google Analytics<\/a> Account ID \u2013 so basically you don\u2019t have to remember what it is each time you want to track something into analytics.\u00a0 <\/p>\n\n\n\n<p>To do this, click \u201cVariables\u201d and scroll down to \u201cUser-Defined Variables\u201d.&nbsp; Select the \u201cVariable Type\u201d of \u201cGoogle Analytics Settings\u201d and paste in your unique tracking ID:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"731\" height=\"418\" src=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/variable-configuration.png\" alt=\"Variable Configuration\" class=\"wp-image-118\" srcset=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/variable-configuration.png 731w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/variable-configuration-300x172.png 300w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/variable-configuration-150x86.png 150w\" sizes=\"(max-width: 731px) 100vw, 731px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Create_A_Tag_To_Track_An_Event\"><\/span>Create A Tag To Track An Event<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Now the variables are available, we can use them to track and collect data when a PDF link is clicked.&nbsp;&nbsp; Create the tag by clicking \u201cTags\u201d then \u201cNew\u201d then choose the tag type \u201cGoogle Analytics: Universal Analytics\u201d and configure as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"732\" height=\"484\" src=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/tag-configuration.png\" alt=\"Tag Configuration\" class=\"wp-image-119\" srcset=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/tag-configuration.png 732w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/tag-configuration-300x198.png 300w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/tag-configuration-150x99.png 150w\" sizes=\"(max-width: 732px) 100vw, 732px\" \/><\/figure>\n\n\n\n<p>Use naming conventions that best suit your requirements \u2013\nthe above will allow you to track all downloads in one category, that can be\nfurther split via the action \u2013 in this case PDF \u2013 but for other file types can\nbe set to DOC or XLS etc.&nbsp;&nbsp; <\/p>\n\n\n\n<p>By setting the Label to the build in variable {{Click Text}} the label will automatically by set to the anchor text used to link to the download.&nbsp;&nbsp; <\/p>\n\n\n\n<p>It may be that you have files with different names use the same anchor text across multiple pages such as \u201cProduct User Guide\u201d or \u201cClick Here To Download\u201d, so it may be preferable to set the label to {{Click URL}} so that this value is unique and therefore easier to determine which resource was downloaded.<\/p>\n\n\n\n<p>Set \u201cGoogle Analytics Settings\u201d to your tracking ID\nvariable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Create_A_Trigger_Based_On_Link_Clicks\"><\/span>Create A Trigger Based On Link Clicks<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You then need to configure a trigger that will fire when a user clicks on a relevant link on your site.&nbsp; To do this, add&nbsp;a new trigger and select the type \u201cJust Links\u201d under \u201cClicks\u201d.<\/p>\n\n\n\n<p>Set this to fire on \u201cSome Link Clicks\u201d then set the conditions to \u201cClick URL\u201d \u2013 \u201cContains\u201d \u2013 \u201c.pdf\u201d.&nbsp; Replace .pdf with the relevant file extension you wish to track.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"734\" height=\"435\" src=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/trigger-configuration.png\" alt=\"Trigger Configuration\n\" class=\"wp-image-120\" srcset=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/trigger-configuration.png 734w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/trigger-configuration-150x89.png 150w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/trigger-configuration-300x178.png 300w\" sizes=\"(max-width: 734px) 100vw, 734px\" \/><\/figure>\n\n\n\n<p>Then associate the trigger with the tag, save, then you\u2019re ready to test.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Test_in_Preview_Mode\"><\/span>Test in Preview Mode<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>No matter how many times in the past you have successfully created a working tag \/ trigger combination, you should always go into preview mode and test.&nbsp;&nbsp; If the above has been configured correctly, you should be able to see your downloads track in real time events within your GA account:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"773\" height=\"488\" src=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/real-time-analytics.png\" alt=\"Real Time Traffic\" class=\"wp-image-121\" srcset=\"https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/real-time-analytics.png 773w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/real-time-analytics-150x95.png 150w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/real-time-analytics-300x189.png 300w, https:\/\/daveashworth.co\/blog\/wp-content\/uploads\/2019\/08\/real-time-analytics-768x485.png 768w\" sizes=\"(max-width: 773px) 100vw, 773px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Publish\"><\/span>Publish<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Once you\u2019re happy that everything is tracking correctly,\npublish your changes to make them live and impress your marketing team with\ntheir new found ability to quickly and easily track user activity on your website.<\/p>\n\n\n\n<p>I hope the above steps are clear \/ helpful, but if get stuck\nor have any questions on how to implement this sort of thing (or similar) then\nfeel free to get in touch, am always happy to help and answer any questions you\nmay have.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Track downloads of PDFs (and any other file type) on your site with ease using Google Tag Manager variables, tags and triggers.<\/p>\n","protected":false},"author":1,"featured_media":116,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,8],"tags":[],"class_list":["post-115","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","category-tag-manager"],"_links":{"self":[{"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/posts\/115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/comments?post=115"}],"version-history":[{"count":0,"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/posts\/115\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/media\/116"}],"wp:attachment":[{"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/media?parent=115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/categories?post=115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daveashworth.co\/blog\/wp-json\/wp\/v2\/tags?post=115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}