I have a client which has a large amount of PDFs. I know that these do not have a tracking code on them, and have assumed we could not track pageviews and visitors landing on these pages. However, I then read this Moz article which suggests that you can by adding a campaign tag? Is this true?

  • 2
    I think GA can track clicks on links to PDFs from your own site, but the tracking snippet cannot be embedded in the PDF itself. See this. I'm not sure how what the Moz article is proposing would actually work, but it appears to be based on the links to the PDFs rather embedded in the PDFs. Feb 6, 2017 at 19:59

2 Answers 2


I wouldn't use campaign tracking for this (campaign tracking is for use on external links for attribution, not internal links).

What you want is Event Tracking.

It's pretty straight-forward, especially if you use GTM.

In a nutshell, you're going to use JavaScript to send GA Events that occur onclick

I recommend avoiding doing this with inline code because it's error-prone and instead set up a script that will send an event when any (internal?) link ending in .pdf is clicked.

You probably need to update the syntax shown in this article to the Universal (it uses the Async syntax) but this will give you a good idea about it.

  • Hi. Yeah we track all clicks on PDFs through GTM. I was just wondering if there was any way to get more engagement information from PDFs. Feb 9, 2017 at 8:36
  • Not that I have ever heard of because they don't contain JS/analytics. I suppose if you wanted to get creative, you might be able to add UTM campaign tracking to links in the PDFs that lead back to your site and/or use a link shortener that reports stats for external links in the PDFs. What you're really talking about is server access logs (then filtered by User Agent to remove bot traffic)...heck, you might even be able to tie the users to analytics via their cookies...but that sounds like a lot of work for little reward.
    – adam-asdf
    Feb 10, 2017 at 4:57

You can add scripts to PDF:

You can invoke JavaScript code using actions associated with bookmarks, links, >and pages. The Set Document Actions command lets you create document-level >JavaScript actions that apply to the entire document. For example, selecting >Document Did Save runs the JavaScript after a document is saved.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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