Hello AEM folks after a long time. So Let’s get started with the topic in which we will track the download of any doc or pdf from your web application.
To track this we will use GTM and Google Analytics along with AEM codebase.
So GTM (Google Tag Manager) is a free service provided by Google. So we will create a container in GTM. You can go to https://tagmanager.google.com/?hl=en#/admin/accounts/create to create GTM container and give the container name and choose Target Platform as Web
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.