Editor's note:
Thanks for visiting GA Tip of the Day. Please see current posts on the Cardinal Path blog.

Round-Trip PDF Tracking with Virtual Pageviews and Campaign Tags

Pages reportview at full size

All virtual pageviews are integrated into the Pages report.

For the simple reason that PDFs do not contain the Google Analytics tracking code, links to PDFs do not, by default, generate data in Google Analytics.

So what we can do? We can generate a virtual pageview on the click action as in the code below, before the PDF even loads.

<a href="/catalog.pdf" onclick="ga('send','pageview','virtual-catalog-pdf')">Download our catalog</a>

In this way, we can generate virtual pageviews that will appear integrated into the Pages report and will act is the equivalent of a virtual page for all other purposes in Google Analytics, such as goals and funnel steps.

But how do we track links back to our website from a PDF? By default, a link back to your site from a PDF would count as direct traffic since there would be no referring website that GA could record. To make these clickbacks trackable, you can add campaign parameters, also called campaign “tags”, to your inbound links.

Please share this post:
Facebook Twitter Plusone Linkedin Email

One thought on “Round-Trip PDF Tracking with Virtual Pageviews and Campaign Tags

  1. Hi Eric- We stopped using virtual page views once they made it possible for a goal based as an event. And absolutely, a virtual page view can be used in a goal step. Thanks, Mary Kay

Leave a Reply to Mary Kay Lofurno Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>