Virtual pageviews in Google Analytics

2 min read
August 14, 2008
Last updated on April 2, 2026

It happens that for a technical reason, two pages of our site have the same URL. This is often the case for an order taking process or for a confirmation page. In this case, how to distinguish them in Google Analytics? How to create a navigation path for a checkout process if the URL of the billing page is the same as that of the shipping page?

 

A first solution consists in changing the URL of these pages. If it were so simple, this post wouldn't be relevant… To avoid a fight with the IT team responsible for the site, opt instead for the solution of virtual page views.

THE THEORY

Let's analyze the Google Analytics tracking code (GATC – Google Analytics Tracker Code ) to understand what a virtual page view is: 

 


The line that interests us here is the one that registers a page view in Google Analytics. It is the _trackPageView function which is responsible for this work. Each time this function is called, Google Analytics records a page view. By default, the function retrieves the URL as it appears in the browser's address bar and saves it.  

By specifying a parameter to the _trackPageView function , GA records a page view by replacing the page URL with the parameter value. In short, it generates a virtual pageview .  

THE PRACTICE

Let's take the example of the checkout process on an e-commerce site as follows, with corresponding URL:

To distinguish the Billing, Delivery and Summary stages, simply change the line that registers the page views in the GATC. For instance:

  • Billing
    pageTracker._trackPageview('/checkout.asp/billing');
  • Delivery:
    pageTracker._trackPageview('/checkout.asp/delivery');
  • Summary:
    pageTracker._trackPageview('/checkout.asp/resume');

And There you go! Now all that remains is to use these virtual URLs to configure a corresponding goal in Google Analytics and analyze the abandonment rate at each of the stages…

Paul
by Paul

Repérer et valoriser ce qui compte vraiment.

Recevez nos analyses et conseils pour rester à l’avant-garde du numérique.