There is a lot of confusion between Virtual Pageviews and Event Tracking within the Google Analytics package. Novices and newcomers can find it hard to differentiate between these two methods as they are similar ways of tagging events within a page. I have created this post in an attempt to clear up some of the common misconceptions that users may have regarding these.
What are these types of tracking?
Event Tracking and Virtual Pageviews allow the user to track events that aren’t normally captured by the Google Analytics web model as they don’t generate a new page view. These kinds of events can come in the form of Flash web pages, video, game and music players, AJAX events, file downloads and external links. By tracking these kinds of events, more valuable and accurate data can be captured and utilised.
By using a Virtual Pageview, the user is telling Google Analytics to register a page view even though no page has actually been loaded. This gives the user the ability to track nearly any kind of event or activity on their web site. However, because the page views appear alongside the standard page views, users may wish to create a duplicated profile where the Virtual Pageviews are filtered out.
To create a Virtual Pageview, you call _trackPageview() and provide any name you would like as the argument, but try to keep it appropriate to what you are doing. An example of the tagging code:
Where ‘virtual_pagename’ should represent the name of the virtual page you wish to be tagged.
The second way to track none-page view interactions is via Event Tracking. The difference between Event Tracking to Virtual Pageviews is that no extra page will be generated when the code is fired. It is also easier to organise events into categories, actions, provide labels and add values to each event that is being tracked.
The Event Track tag contains four different unique elements:
- Category (what is being tracked e.g. video, game, music player).
- Action (the event being tracked e.g. play, pause, back, forward, submit).
- Label (possibly the name of the video, game or document. This is an optional element and doesn’t need to be included).
- Value (integer to assign a value to any tracked page object. This is another optional element and is not needed to function correctly).
An example of code:
_gaq.push([‘_trackEvent’, ‘category‘, ‘action‘, ‘label‘, integer_value]);
As mentioned above, ‘Label’ and ‘Value’ are optional elements and are not needed for the event tracking to function properly.
Virtual Page Views vs. Event tracking
Both Virtual Pageviews and Event Tracking have their own strengths and weaknesses:
With Event Tracking it is possible to track event based actions in much more detail than is possible with Virtual Pageviews. An example of this would be using Event Tracking on a music player – it is possible to find out how people use the music player and see how different events compare with site usage. Also, as mentioned above, Event Tracking doesn’t generate a page view when it is fired, so your total number of page views won’t inflate.
When using Virtual Pageviews, it is possible to create and assign goals, which isn’t possible with Event Tracking. An example of a goal would be when a user clicks three or more videos during a single visit.
Hopefully you have gained some insight into differences between both Virtual Pageviews and Event Tracking. However, it should be noted with the introduction of the new Google Analytics beta, users are able to define goals via event tracking. This is a big step forward as many users have been requesting this feature for quite some time. It seems that virtual page views may become obsolete once this is implemented. This new feature will be known as Event Goals and you can find out more about it from here.