As amazing as Google Analytics is (and believe me, it’s pretty darn amazing), the out-of-the-box, stock version of the software is just that: basic.  So, we’re engaging in a series of lessons to help you maximize both the quality, and amount, of data that you can track in your Analytics profile.  The first thing we’re focusing on is Virtual Pageviews.  These are important because the basic Google Analytics tracking does not capture interactions with, for example, anything on your page that uses Flash (e.g. an embedded Youtube video), links for downloading items from your site, or links that take you out of the site (e.g. Social Media Icons.)  The reason for this is that when a visitor interacts with these types of things, no pageview is automatically generated.

The beauty of Virtual Pageviews then is that you can create one to represent just about any activity or interaction you want.  All that you’ll need to do is call (write code for) “track Pageview” each time a specific action that you want to capture occurs.

To begin, notice first in the Analytics code, a segment that looks like this: [code]_gaq.push([‘_trackPageview’])[/code]  This basic code lets Google Analytics know that the browser has loaded a page.  Now, as mentioned above, to capture pageviews on things like an activation of a youtube video, or the download of a form, you’ll need to take that code and add an additional URL to it.   (e.g. “_gaq.push([‘_trackPageview’, ‘/events/playvideo’])” This lets Google Analytics know to track the interaction, even though no new page has actually been loaded.  These new captures can be viewed  in the “Content” section of your Google Analytics profile, alongside the normal pageviews that Analytics tracks.  Here is some code to get you started:

Virtual Pageview Code to Track Downloads:
[code]<a href="http://www.clearlym.com" onClick=*_gaq.push([‘_trackPageview’, ‘/download/example.pdf’]);’>[/code]

Tracking a Flash Event:
on (release) {// Track with no action getURL(“_gaq.push([‘_trackPageview’,’/download/example.pdf]);”);}

Keep in mind that any virtual pageviews you want to track should be placed AFTER the Google Analytics tracking code.  Additionally, because these pageviews are placed with the rest of the regular pageviews, it might be helpful for data dissemination purposes to filter them into their own category so they can be tracked separately.