How To Use Google Analytics To Track Views of PDFs On Your Website
Posted on 20. Sep, 2009 by Lyz in analytics, blog
Wouldn’t it be great to be able to track how many people click on the links in your website that lead to a document or file rather than another web page?
The difficulty of course with PDFs, Videos and Word Docs is that you can’t embed your Google Analytics (GA) tracking code in them. But there is a way to use GA to get these stats – you can also see where the person that viewed the file came from and whether they’ve been on your site before.
Imagine knowing that your PDF was viewed 50 times last week, 25% of the people that viewed it came from your natural search engine rankings, 10% from an email you sent out and the rest from your pay-per-click (PPC) advertising.
How to track ‘reads’ of your files with Google Analytics:
Insert the snippet of code shown below into the <a> tag of each link you want to track
Important: make sure you change the variables to suit your site (see below)
onclick="javascript: pageTracker._trackPageview('/downloads/free-report');"
Change the ‘/downloads/free-report’ to match your file
If you had a video file you might have something like the below where /video is a description of the file type and /soup-recipe is a short description of the file contents
Note: this is not a directory path to your file it’s just so you can sort and understand your stats more easily in GA – make sure you choose a convention and stick to it otherwise the reporting is hard to understand!
onclick="javascript: pageTracker._trackPageview('/video/soup-recipe');"
That’s it!
How to find your stats in Google Analytics:
1. Log into your GA account and go to your dashboard
2. Select ‘Content’ from the left hand menu

3. Select ‘Top Content’ from the sub menu that appears
4. Next you need to use a filter to just display the files you’re interested in, so in my case I’m tracking /downloads/optimisation-report/ so I typed download into the ‘Filter Page’ text field and clicked ‘Go’
5. Now I have a list of all links on my site where the tracking code contains the download prefix
6. Use Advanced Segments to see where the traffic for each download originated – simply check the boxes next to the segments you’d like to see
7. You will now see that each separate file in your list has expanded to show the split of traffic sources as dictated by the segments you chose. From this screen I can see that 1 person has downloaded my free report and that person was a return visitor.

Now you can clearly see which marketing activities produce the best results and you can fine tune your messages accordingly. This is particularly useful where you’re offering a free download as an enticement before someone buys from you. For example, on this site I give away a free DIY website optimisation report – I’m using this tracking method to see how many times it’s downloaded and whether it’s new visitors or repeat visitors who view it most often. Is it people who click on a PPC ad or those that come through organic search engine rankings who are more likely to look at it.
Of course most importantly I can more accurately plot my conversion funnel and so work on improving web traffic sales.
For more help with setting up tracking visit the Google Help Centre.

Give your website an MOT today… 
Hi, Just supposed I’d let you know your website is displaying funny in my K-melleon browser. Looks good from what I can see though.