Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 6 down vote accepted

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

share|improve this answer
    
Thank you! I didn't know there was a different one for asynchronous! –  RandomBen Sep 20 '10 at 21:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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