20 Jan 2016
Virtual Pageviews via Google Tag Manager
Reading time: 5 mins.

Virtual Pageviews via Tag Manager and conversion funnels in Google Analytics without ThankYou Page!

In the previous chapter of our tutorial we learnt how to implement Google AdWords conversion tracking without Thank You page using custom event (formSubmitOK) in Google Tag Manager specifically created for this purpose as a trigger. This type of tracking is applicable to other conversion tracking codes, of course, not only to AdWords.

In this post we will explain how to create a conversion funnel without Thank You page using virtual pages created with Google Tag Manager.


How to fire Google Analytics virtual pageviews in Tag Manager

  1. Configure a new Google Analytics Pageview Tag as you did before for Google Analytics basic tracking tag.  Do not forget to select the virtual URI (page path) you wish to populate Google Analytics with. Title and Referrer can be included as well in Fields to set.
    Analytics tag virtual pageviews with tag manager
    * Instead of a static route,  we could use a variable to generate dynamic virtual page views. ** We can also set up virtual page title. *** Variables can be used to define the referrer dynamically. For instance, {{Page Path}} if we wish to configure as referrer the page where the action generating virtual page takes place, we can use {{Page Path}}.
  2. We then define the activation trigger for the tag. This is the key point in virtual page generation.

Let’s see some practical examples.

CASE #1: Form without thank you page

As in the example set in a previous post, we use exactly the same custom event trigger in Form Submit OK:

Custom GTM event formSubmitOK

In this case, however, we wish to create a Thank You virtual page when the form is submitted correctly, sending a Page view to Google Analytics instead of an event. In this sense, we use the same trigger but the Universal Analytics Tag will be a bit different:

Analytics tag virtual thankyou page tag manager



Although the form does not generate a thank you page, this tag and trigger combination allows us to have a thank you page ready for setting up Google Analytics goals and -even better- goal conversion funnels 🙂

Important remark:  conversion funnels can only be set up in (free) Google Analytics with the page view hit type. Likewise, they require to set goals such as “landing page”. Consequently, it might be interesting to track certain forms in this way instead of resorting to events. So that we could track the previous steps to conversion and the Goal Path.

CASE # 2: Tabbed navigation

If we want to set different virtual page views when switching tabs, we have to find the differences in the URL or in the HTML code in the tabs’ tags. For instance, the HTML tag attributes such as href, id, classes, title, etc., can help us to populate Google Analytics with virtual pageviews in a dynamic way via GTM.

For instance, {{Click ID}} variable can be used  to differentiate among tabs’ codes and set up dynamic virtual page views. Remember that IDs are unique and can work as distinctive elements. So, if we have got suitable ID attributes, it is usually the best option.

Imagine that tabs were built with links containing unique IDs  (tab1, tab2, tab3). This would be an example of a tag trigger:

Virtual pageviews tabbed navigation GTM

In GTM v2 it is no longer necessary to set Event Listeners for clicks, forms, etc. Therefore, use  “.*” RegEx in Enable When so that Link Clink event is available in all pages. Next, set the following tag to see the event in your reports.


Virtual pageviews tabbed navigation tag manager


Remark: Add {{Click ID}} after {{Page Path}} variable so that Virtual Pageviews  appear listed by URI + ID in content reports. In this way, we can compare Virtual Pageviews to their container pages, i.e. where the tabs are located, and keep inner data coherence. Besides, if we add {{Click Text}} in “title” Field to set, we probably get richer data for the virtual page view.


  • Internal Page navigation which uses anchor links or  URL #hash navigation. On the one hand, we need the {{Page Fragment}} variable to identify and send the current anchor as part of the virtual URL.  On the other hand, we need a method based on events to register the changes in the anchor (click on the corresponding links or detect changes by default with the History Change Trigger and some additional JQuery to change the hash without being required to click on  a link).
  • Websites with one page (Parallax scrolling websites): They can be used to measure the most viewed sections as Pageviews. 
  • Purchase process using AJAX: Virtual pages can be used to generate conversion funnels when there is no changes in the URL among steps (funnels only work with landing page goal). It is not possible so far to generate a funnel for sequence of events (unless you have Google Analytics Premium, which has this possibility at Custom Reports settings, I think). However, in this sense we could resort to virtual navigation to create virtual pageviews.  Virtual navigation based on dom elements, click on buttons, etc. It is a very complex case. However, it is worth trying because it provides invaluable information.