Virtual Pageviews Vs. Event Tracking

Virtual Pageviews vs. Event TrackingI recently ran into a 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. They also want 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 demonstrate situations where you should use one versus the other.

Event Tracking

What is Google Analytics event tracking?

I wrote past rambling that goes into the details of adding event tracking in Google Analytics. This prior post will show you 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). This comes in handy when you are multi-variant testing!

One thing my original event tracking blog post won’t tell you is that there is also a WordPress plugin called GA Event Tracking that I’ve come to love. If you have a website on WordPress, this can be an easier alternative to adding in the code on every element of the site. You simply identify the class or id of an element and assign 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 any user click on an Email address, click to call link, video link, 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 defined event happens (but keep in mind that events can not be used to set up goal conversion funnels).

Virtual Pageviews

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 and submit buttons 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, you are trying to track a “next step” blink in a multi-step form. Your code could look something like this:

(‘send’, ‘pageview’, ‘form-step-two’)>Next Step

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:

Using Virtual Pageviews for Goal Conversions

It can be difficult to determine if you should use virtual page views or event tracking to analyze user behavior. You need to ask yourself a few questions to determine which method is best for your particular situation.

  1. Do you wish to use these actions within a goal conversion funnel?
    1. If you answered yes, you’ll want to use virtual pageviews.
    2. If you answered no, you’ll want to use event tracking.
  2. Do you find it acceptable for your method to impact other reporting metrics such as total pageviews, pages per session, and bounce rate?
    1. If you answered yes, you can use virtual pageviews.
    2. If you answered no, you’ll want to use events.
  3. Do you want to be able to track a simple goal completion based on this action?
    1. If you answered yes or no, events or virtual pageviews can both be used in setting up a goal conversion.

Questions? Comments? Let us know!


There are currently no responses.

Leave a Reply

Your email address will not be published. Required fields are marked *

fourteen − 10 =

Request A Quote

Let's take your business to the next level. Fill out the form below to get started!

"*" indicates required fields

Sign me up for IronMail
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
This field is for validation purposes and should be left unchanged.