Monday 21 August 2017

How to Track PDF file with Google Analytics?


To track any PDF file on your website, simply follow the steps below and you’ll be well on your way. It gets a bit technical from here on out, so roll up your sleeves:
1. First find a page that links to one of your PDF files.

2. Find where the PDF file is on the page – look for the anchor (<a>) tag. It should look something like this:
<a href="files/quarterly-earnings.pdf" target="_blank">Quarterly Earnings Report</a>

3. Insert the following “onClick” event within this anchor tag. It should look like this:
<a href="files/quarterly-earnings.pdf" target="_blank" onClick="pageTracker._trackPageview('/files/quarterly-earnings.pdf');">Quarterly Earnings Report</a>

4. Upload the page and enjoy the results! You should see the number of times that your PDF file was accessed within the Content >> Top Content section of your Google Analytics profile.