I have a number of PDFs on my website that I want to track when people click on them. To do that I added this code to each <a> tag referencing the PDFs,


I then made sure the page with these links had my Google Analytics code and that the code was above all of my links (I placed it at the bottom of the <head> section. This exactly what I have (I replaced my URL and Account # though)

<script type="text/javascript">
            var _gaq = _gaq || [];
            _gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
            _gaq.push(['_setDomainName', '.YYYYYYYYYY.com']);

            (function() {
                var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
                ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

My issue is that 3 days later, I have 0 page views for the pdf documents in Top Content and the pages are not showing up at all. Is this because I made a mistake with my code placement or is it an issue with where I am looking in Google Analytics?

I do know that I have had over 1000 page views on my site and the PDFs are rather popular so I am sure something isn't working properly.


Have a look at http://www.google.com/support/forum/p/Google%20Analytics/thread?tid=16314668d395d15d&hl=en and http://code.google.com/apis/analytics/docs/tracking/asyncUsageGuide.html

Looks like you are using asynchronous tracking but the old way to call _trackPageview

  • Thank you! I didn't know there was a different one for asynchronous! Sep 20 '10 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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