Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I'm looking for the proper way to track pdf downloads from both emails and our site links.

If I have many pdfs on a single page, how do I track the pdf downloaded? I found an article on Moz explaining to add "&PDF=name of pdf" to the link as a way. How does this affect bounce rate and other measures? If a user lands on a page and clicks a PDF on that page in less than 30 secs is that a bounce?

Also email tracking links to PDFs. What is the best way to track those links? They would never be considered a session if they never hit the analytics code. Thanks all!

share|improve this question

3 Answers 3

up vote 1 down vote accepted

If I have many pdfs on a single page, how do I track the pdf downloaded?

If your goal is to track PDF's based on type or subject then you can add even tracking code to each one and it will show up under your Behavior -> Events report in GA. This could get very tedious and really depends on how many PDF's we are talking about. Your code will look something like this:

<a href="#" onClick="_gaq.push(['_trackEvent', 'Downloads', 'PDF', 'PDF Title Goes here']);">Download PDF</a>

If you use Google Tag Magager there are a few other options that you can you utilize. Using even triggers, listeners and HTML5 data parameters. Check out this article on how to use GTM to track downloads.

If you have a ton of PDF's I would recommend a more automated tracking with GTM.

How does this affect bounce rate and other measures? If a user lands on a page and clicks a PDF on that page in less than 30 secs is that a bounce?

If you set this event to non-interaction = False then it will lower your bounce rate because the action/interaction it will be added to the bounce rate calculation.

Also email tracking links to PDFs. What is the best way to track those links?

For email you can use campaign tracking code within your links. You will be able to find them under your Acquisition -> Campaigns report. This will not count it as a sessions unless your link is to a page where the PDF is located. Code would look something like this:

domain.com/?utm_source=Email&utm_medium=Newsletter&utm_term=PDF%20Link&utm_campaign=My%20Weekly%20Newsletter

If you want, you could actually track both email and website PDF downloads using campaign code. That way you could have everything under one report. Just change the Source parameter value to Email or Website or something.

Lastly, whatever you will end up doing, make sure to think long and hard about how you label your events and campaigns. You want this to be well organized so its easy for you to see the whole picture and add sub evens and campaigns under the same report.

share|improve this answer
    
In case he uses analytics.js, here's the guide developers.google.com/analytics/devguides/collection/… and the rest it would be the same. –  lucgenti Jun 3 at 15:33
    
@lucgenti Thanks. I keep forgetting that some people might not be running universal. –  dasickle Jun 3 at 15:36

I believe that a better way to track PDF’s, and other file downloads, is to create a mechanism to take advantage of the Google Analytics Measurement Protocol. It would allow you to track when the file was actually accessed from your server instead of when a button\link was clicked.

The con of this approach is of course creating the mechanism to handle the HTTP Request to Google Analytics and then returning the file to the user without affecting their experience on your site.

Here is a high level view of how I handle files:

  1. Someone navigates to www.example.com/example-file.pdf
  2. The webserver rewrites the URL to www.example.com/file-handler/example-file.pdf. The rewrite means that the user’s browser still shows www.example.com/example-file.pdf in their address bar.
  3. The file-handler determines if the file actually exists either on the webserver or in a database
  4. The file-handler makes an HTTP Post to https://ssl.google-analytics.com/collect with this data: v=1 // Version. &tid=UA-XXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=pageview // Pageview hit type. &dh=example.com // Document hostname. &dp=/example-file.pdf // Page. (The URL path that the user used to access the file) &dt=Example File // Title. (The file name or make a custom title)
  5. Clear the response
  6. Change the response content type to 'application/pdf'
  7. Add the header so the browser knows that you are sending it a file
  8. Display the file to the user.

Within Google Analytics I can report on files the same way that I can any webpage. The Measurement Protocol also has the ability to fire events and associate calls to a campaign.

If you have any questions let me know, and I hope that helps.

share|improve this answer

You should also consider server side statistics to gather data like accesses to files. You can install a system on your server which will analyse the server log files.

For example Webalizer http://www.webalizer.org/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.