How to track file downloads with GTM
Let’s say you’ve put a .zip file or a .pdf file on your website available for download, and now you want to know how many times that file has been downloaded, for that particular purpose You can use Google Tag Manager (GTM), the following steps will guide You step by step on how to achieve that important goal.
Step 1 – Create new Trigger
Step 2 – Trigger Type
Step 3 – Trigger Settings
Be sure to select “Click URL” from the first drop down menu, then “Contains” and finally in the last box put “.zip” or the extension of the file you want to track.
Step 4 – New Trigger configuration complete
The following image shows the settings you must configure when creating the new tag.
Step 6 – New Tag listed
Step 7 – Enable Preview mode and refresh the page
Once both the trigger and also the tag are configured you must enable the GTM Preview mode, take a look at this article if you need help enabling the GTM Preview mode, then open the page of your website where the .zip file available for download is located and proceed to download the file, at the bottom of the page you’ll see the TAG that was fired, see image below.
Tag was successfully fired
You can use the same steps to fire a tag to Google Analytics (GA) every time a .pdf file is downloaded, or if you prefer tu put both extensions .zip and .pdf in the same tag, then you can use a regular expression as shown below.