Now on your GTM dashboard, go to variables and add some click variables:
Now we will create Tags and Triggers to track the event. Now navigate to Tags option on GTM Dashboard and create a Event with following fields and values. Select Tag Type as Google Analytics : Universal Analytics
Google Analytics Settings variable needs to be created using the tracking id from Google Analytics which can be obtained from going to Google Analytics dashboard and Admin. Then Tracking Info > Tracking Code. Copy the ID that looks like this UA-XXXXXX-XX and paste it to the Tracking ID field in GTM.
Now we will create a trigger which will be attached to this tag that we created above. Create a trigger of type Just Links.
Add the type of files you want to track. Once whole configuration is done then publish the tag created and go to Admin in GTM and open Install Google Tag Manager and copy paste the scripts in the head.html and the body.html of your project.
As I am using AEM SPA code setup so I pasted it in my body.html and customheaderlibs.html
After pasting the script snippet in code base and publishing the tags now once you click/download any pdf or doc it will track it as part of Google Analytics reports. You cam go to Google Analytics dashboard and go to Realtime and then Events, it would be logged there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.