Tracking Downloads and Clicks with Google Analytics Using Virtual Pages

June 10th, 2010

Something which I have struggled with in the past  using Google Analytics is tracking downloads and those forms which do not have a thank you page. There is a fix to all this, which is to use the trackPageview JavaScript function.

One of the most useful things about Google Analytics is to understand where all the metrics about your conversions; how they arrived at the site, how they journey around the site, how long they spend etc. But all of these factors take in to consideration one thing, that you are actually tracking your conversions.

Obviously if it is a straight forward conversion that starts at one page, finishes at the other, all with your handy google code on then that’s great, sorted. But that always isn’t possible. What  if your conversion cannot have your Google code on? A PDF, WMV etc or one of those clever little forms that does not take you to a Thank You page, rather keeps everything on the form page itself. Google Analytics cannot track any of these conversions, so you are left in the dark. The best way to do this is by creating virtual pages.

Simply put, these are “pages” that you are creating for Google Analytics only. Your visitors cannot see them or land on them, they do not even know they are there, they just pass through it on the way to their lovely download.

So how to do this. Well in cookery show style:

Take your bog standard download URL:

<a href=”http://www.yourwebsite/download/yourfile.pdf”> Your File </a>

Mix it with a juicy TrackPageview code:

onClick=”javascript: pageTracker._trackPageview(‘/downloads/yourfile’); ”

and you end up with something like this:

<a href=”http://www.yourwebsite/download/yourfile.pdf” onClick=”javascript: pageTracker._trackPageview(‘/downloads/yourfile’); “> Your File </a>

Serve it on your website and enjoy. Mmmmm tasty.

So now when someone clicks on your download, Google Analytics will track the page as /downloads/yourfile. You can now set up a Goal and track to your hearts content.

Just a couple of pointers, always put the code at the end of the URL and remember to change the name of the virtual page you are creating (‘/downloads/yourfile’), it can be called anything but its best to use a clear sensible name that you will understand in the future.

Why don’t you talk to us about our Website Analytics Consulting Services.

Categories:
Analytics Analytics Filters Google Analytics SEO SEO Tips

3 Responses to “Tracking Downloads and Clicks with Google Analytics Using Virtual Pages”

  • Fawad Rashidi says:

    Thank you very much for the instructions. Is it possible to use Google Analytics to track campaign report for newsletters? Newsletter companies usually provide such report after I send my newsletters but I was wondering if Google Analytics could help me get more information.

  • Colin says:

    Hi Fawad,

    It is possible to track newsletters by using the Google URL Builder. This will add tags to the URLs on your newsletter so Google Analytics will understand where it has come from and you can then track all your visitors (at a cheaper cost than your newsletter provider).

    Joe wrote a post explaining this which can be found at: http://atelier-seo.com/2010/05/seo-tips-separate-organic-traffic-data-from-other-campaigns/.

    Hope this helps and give us a shout if you have any problems.

    Colin

  • Fawad Rashidi says:

    Great. Thank you very much for the quick reply.

Leave a Reply