I am new to GTM V2.
I would like to track PDF downloads using custom metric. I can built custom dimension for the same, but am not able to create custom metric.
I want report similar to below:
PDFname no. of download
xyx 1
abc 5
- xyz pdf downloaded 1 time abc 5
- PDF name and no. of download are column heading , rest are it values
I want to create metric using GTM v2. I don't want to write JavaScript for the same. I have done above report using event tracking, but want to do the same with custom metric
Please explain in detail on how to create custom metric, using GTM.
Please help me on the same as soon as possible.
In the new version of Google Tag Manager, 'Macros' have been renamed to 'Variables' so I will be referring to them as such.
I implemented a tag which tracks when a PDF is downloaded on my website. I did this by creating a custom Variable. Follow the steps to create the variables required to track PDF downloads.
1) Create a new variable called 'element', make this variable an 'auto-event' variable. Select 'Element' from the Variable Type drop-down menu. Click 'Save Variable'
2) Create a new variable called 'Click Link File Name'. Make this variable a Custom Javascript Variable. Insert the following code into the configure variable field.
Click 'Save Variable'
3) Create the Trigger - Name the Trigger "PDF Download"
4) Create the Tag
What this set of instructions will do for you is set up variables able to record the name of your PDF file as well as the ability to track it as an event. The trigger that we set up in step 3 tells GTM to ACTIVATE the tag on every page (.*) and FIRE the tag when the user CLICKS a link ending with the string ".pdf". The tag we set up tells GTM to send an event to your GA Account with the category, action and label listed above. The label of the event will contain the name of the PDF file that was downloaded.
If you want any more customization than this let me know and I will provide you with a solution to track things like - Which page the PDF was downloaded from