5K members online now
5K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
Guide Me

Tracking pdf downloads

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

We have a website hosted by SquareSpace and are using GA to get our statistics.  One of the metrics we are looking for is the number of pdf downloads by document, i.e. we need to know which reports have been downloaded and how many times they have been downloaded.  Problem is, we have been unable to find a way to get the correct code snippet inserted in the page header.  Any ideas as to how this can be done?  Thank you.

1 Expert replyverified_user

Re: Tracking pdf downloads

Follower ✭ ✭ ✭
# 2
Follower ✭ ✭ ✭
Can you implement Google Tag Manager?

If yes you can use the auto event tracking feature in GTM to track those downloads:

If you can't put GTM you need to put the event tracking code on the actual download button (not in the header).
So each download button should have a code like this:
ga('send', 'event', 'Videos', 'play', 'Fall Campaign');

This is explained here:

Re: Tracking pdf downloads

[ Edited ]
Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

We have investigated all the suggested solutions. The problem is, we have been unable to inject the required code into our SquareSpace site. They have not been able to find us a solution, so we have turned to the GA community to see if anyone has some ideas.

David M

<edited by a Community Manager as noted below>
NOTE: This post has been edited by a Community Manager - per Community Guidelines - in order to remove contact information which was most likely due to an email or mobile footer. This is done in order to protect account security and/or privacy. Please be sure to remove this information in future replies. Thank you for your understanding.

Re: Tracking pdf downloads

Top Contributor
# 4
Top Contributor

Hi, David,

I'm not familiar with SquareSpace at all, but from reviewing their support pages, I came across this, which says that:


Universal Analytics currently falls out of the scope of our integration with Google Analytics. Until Google retires Classic Analytics codes, tracking code for Universal Analytics must be added in Code Injection, and we can’t offer more help on any custom code modifications.

It suggests to use code injection in the header. So what you can do is to place some JavaScript in that injection section so that you can capture PDF download clicks. The code might look something like this, if you are using jQuery (untested, so use at your own risk):

ga('send', 'event', 'download', 'pdf', $(this).text().trim());

So this basically enables you to track as an event the clicks of any PDF on your page.

Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn