Virtual Pageviews Vs. Event Tracking
Virtual Pageviews Vs. Event Tracking
I recently ran into dilemma helping out a client with tracking conversion goal funnels for ajax forms. In other words, there are no individual URLs for steps within the conversion funnel or even a confirmation page for that matter. They wanted to be able to track form completions independently and also be able to analyze at which point individual users abandoned the goal conversion path.
After some deliberation and additional research, I came to the conclusion that the best way for them to do this (without completely rebuilding large portions of their site that a different company built) was to implement code for virtual pageviews. However, virtual pageviews may not always be the best solution as they will increase the total pageviews you see in your Google Analytics reports. So for today’s post, I am going to explain the difference between virtual pageviews and event tracking and situations where you should use one vs. the other.
What is Google Analytics event tracking?
I wrote past rambling that goes into the details of adding event tracking in Google Analytics. Check it out to learn how to implement event tracking on your website. Event tracking is a fairly easy way to track user engagement on a website that the standard Google Analytics code will not automatically track for you. For example, this would allow you to track clicks on elements such as Email text links, phone number click to call links or views of a video embedded on a page (and much more). Comes quite in handy when you are multi-variant testing!
One thing my original event tracking blog won’t tell you is that there is also a WordPress plugin that I’ve come to love called GA Event Tracking. If you have a website on WordPress, this can be an even easier alternative to adding in the code on every element of the site. You simply identify the class or id of an element and assigned the category, action, and label for each event you wish to track.
When to use event tracking?
Use event tracking if you want to track when a user clicks on an Email address, click to call link, watches a video, clicks on a document download link, or if you want to track specific CTAs throughout your website. You can also set up conversions in Google Analytics to track a goal conversion anytime a defines event happens (but keep in mind that events can not be used to set up goal conversion funnels).
What are virtual pageviews in Google Analytics?
Virtual pageviews are implemented by adding a snippet of code to various elements of a website in order to track specific actions as pageviews. Setting up a virtual pageview will allow you to assign a unique URL to an action taken on just about any element. *Note* using virtual pageviews WILL count toward your total pageviews, pages per session, bounce rate, etc. so make sure you have an actual need for virtual pageviews before you choose this method. Think back to my original example of the form using ajax with no confirmation page or unique URL. You could add a virtual pageview to the next buttons and submit button within the form. This could also be done using event tracking, but herein lies the dilemma and the deciding factor for this particular example.
The syntax to implement virtual pageviews in Universal Analytics (analytics.js) is as follows:
ga(‘send’, ‘pageview’, ‘page path’)
Page path is where you will set what you want the virtual page URL to be. For a quick reference example, let’s say you’re trying to track a “next step” blink in a multi-step form. You code could look it could look something like:
<a href=”#” ga(‘send’, ‘pageview’, ‘form-step-two’)>Next Step</a>
When to use virtual pageviews?
Typically I would recommend using event tracking over virtual pageviews because of the impact it has on overall site metrics. That being said, if you need to track these actions within a goal conversion funnel, you will need to use virtual pageviews. Goal conversion funnels can only be set up using unique URLs for each step within the funnel. Virtual pageviews will allow you to assign unique URLs to these actions allowing you to incorporate that action into a goal conversion funnel. Once you have the virtual pageviews implemented, you will set up your goal conversion just like any other. Identify the steps and watch the data roll in. After you get rolling, it will look something like this:
It can be difficult to determine if you should use virtual page views or event tracking to analyze user behavior. You’ll want to ask yourself a few questions to determine which method is best for your particular situation.
- Do you wish to use these actions within a goal conversion funnel?
- If you answered yes, you’ll want to use virtual pageviews.
- If you answered no, you’ll want to use event tracking.
- Do you find it acceptable for your method to impact other reporting metrics such as total pageviews, pages per session, and bounce rate?
- If you answered yes, you can use virtual pageviews.
- If you answered no, you’ll want to use events.
- Do you want to be able to track a simple goal completion based on this action?
- If you answered yes or no, events or virtual pageviews can both be used in setting up a goal conversion.
Questions? Comments? Let me know by filling out the form below!
There are currenty no responses.