Reputation: 1
I am tracking PDF download using custom metric. I have written following code
<script>
dataLayer.push({'DLPdfdownload': 1});
</script>
DLPdfdownload
is datalayer variable name that I have created in GTM V2.
Script is executing but the problem is that value for PDF download doesn't increment even if I download particular PDF many time. Value in the custom metric remains 1 only it doesn't increment with the download.
What changes do i need to make in script so that value get increment every time I download a PDF
Upvotes: 0
Views: 1293
Reputation: 484
Try to push some 'event' key's value in dataLayer with custom metric data and use custom event with this value as a trigger. Might be that you send data to GA before your custom metric value is pushed to dataLayer.
Upvotes: 1
Reputation: 32760
Your question is somewhat incomplete. I'm going to assume from context that you are using Google Analytics with GTM and that you have already created a custom metric in your property settings.
The custom metric will only be incremented if you send it along with a Google Analytics hit. So you need to look up the numeric index for your metric in the property settings. Then you need to set up an Analytics tag that is triggeres when the pdf is downloaded, e.g. by a link click trigger. In that tag you expand the "custom metrics" section, enter the numeric index of your dimension in the index field and your dataLayer variable in the value field.
If that is what you are already doing, or if I have misunderstood your problem, you need to amend your question with more information.
Upvotes: 1