4

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,

onclick="pageTracker._trackPageview('/download/nameOfPDF.pdf');

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']);
            _gaq.push(['_trackPageview']);

            (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);
            })();
</script>

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.

1 Answer 1

6

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

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

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.