If you don’t know what Virtual Pages are and learn more about how they can help you especially if you are tracking a Single Page Application, I suggest you to read my dedicated post.
To better follow the different steps I will take, let’s imagine this kind of situation: I want to implement virtual pages within a sellout funnel.
My funnel behaves like this:
- Step 1: The URL you upload is www.example.com/product123#/account
- Step 2: The URL you upload is www.example.com/product123#/order
- Step 3: The URL you upload is www.example.com/product123#/shipping
- Step 4: The URL you upload is www.example.com/product123#/thank-you
By default, in Google Analytics I am unable to collect values after the # symbol (account, order, shipping, thank-you).
For this reason I need to create a virtual page in each step of the checkout.
Virtual Pages: create a new tag
The steps to take within Google Tag Manager are as follows:
- Create a new Tag by clicking on Tag> New:
2. Select the type of tag (we select the Google Analytics tag: Universal Analytics):
3. We select the type of hit for this tag: we choose the pageview hit:
4. We select the Google Analytics variable, in order to send the information to the Property that interests us:
5. We select the Enable overriding settings in this tag and click on More Settings> Fields to set:
6. In this field we will create our virtual page by entering the page we want to create and the title of the same. Click on Add Field and write in ‘page‘, while in the “Value” block we insert the path of the page we want to create: I will use ‘/step-1-account‘:
7. Now we have to insert another field to give a Title to this virtual page. Click on Add Field and enter ‘title‘ and in the “Value” block the title you want to give to the page: I will write ‘Checkout Step 1- Account‘ to acknowledge that it is the first step of the checkout.
8. Let’s give our tag a name.
Recap: we created the tag and entered the path of the virtual page and its title. We have also selected the Google Analytics variable to indicate which tool to send the information to.
We continue by inserting the trigger to activate our tag under certain conditions.
Virtual Pages: Create a new trigger
Now we need to create the trigger in order to fire the tag in certain situations.
In this case a lot depends on the type of website you are tracking and when you want to activate your tag. The indications below are indicative and may vary, depending on what you want to track in your case.
As mentioned above, I want to send my virtual page when the user is in the first step of the sellout funnel which, in my example was in this URL: www.example.com/product123#/account.
- I create my own History Change trigger:
2. Select the item Some History Changes:
3. Now select the Choose Built-in Variable item from the list:
4. We look for the variable that is called New history Fragment from the list:
5. We select the variable to enable it and make it available in the future in Google Tag Manager and in the value field enter the ‘/ account‘ item that is present within the URL, so that GTM will be able to read the value after the # symbol
6. Let’s name the trigger and save:
Recap: we have associated to our tag the trigger to read the value of the URL after the # symbol.
Now let’s save and test everything.
This process must be done for all the pages of the sellout that we want to track and in which we want to insert virtual pages.
If I go back to my initial example, this means that in each of these pages of the website, the following virtual page will be shot:
- Step 1: site page www.example.com/product123#/account -> virtual page created in GTM: /step-1-account
- Step 2: site page www.example.com/product123#/order -> virtual page created in GTM: /step-2-order
- Step 3: site page www.example.com/product123#/shipping -> virtual page created in GTM: /step-3-shipping
- Step 4: site page www.example.com/product123#/thank-you -> virtual page created in GTM: /step-4-thank-you
A tag and trigger must be created for each page as described above.
Virtual Pages: Create a Goal in Google Analytics
Now that we’ve created the tags and triggers, a virtual page will be created on each page of the checkout funnel website.
We can now use these virtual pages to create a new Goal in Google Analytics.
The purpose of this Goal is to show us every time a user arrives at the Thank you page by passing through every page of the funnel.
In this case, we need to go to in the Admin section and, within the View where we want to set the goal, create a new Destination Goal.
Here’s how to do it. Let’s create a new Goal in the GA view.
We select a custom type template and give a talking name to the Goal, for example: “Checkout Completed”
We select the Destination as the type of Goal: this means that my goal will be completed if the designeted destination is reached.
Click on Continue and enter various information:
- the landing page, that is the thank-you page that must be reached by the user to complete the Goal
- let’s activate the Funnel option
- We insert the name of the Page (the “title” value written in the GTM Tag in the previous steps)
- We insert the URL of the virtual page we created (the “page” value written in the GTM tag)
Once the new Goal is set, you will be able to see the conversions in the dedicated report:
You may also be interesting by the following articles:
- Content Grouping in Google AnalyticsAnalyzing the contents of a website, has it ever happened to you that you want to know what are the performances of the main sections? Each website is divided into sections, which reflect the organization of its contents. This applies to all sites, from e-commerce, which have sections of product categories, type of articles, sellout […]
- Google Tag Manager: Lookup Table VariableThe Lookup Table variable in Google Tag Manager allows you to read the value of an input and, if this value matches certain requirements, it will return some output. There are several situations where this variable can help us: rename a web page, rename the Source dimension for a social (Instagram, Facebook LinkedIn etc.) and […]
- What Virtual Pages are in Google AnalyticsPageviews are one of the best known metrics, present in almost all web analytics reports. This metric is populated with pageview hits, which are sent to Google Analytics every time we view a page or refresh the page itself. However, in recent years a series of technologies have developed that improve user navigation on the […]
- How to track Virtual Pages: Google Tag Manager and Google AnalyticsIn this post, we see how to track Virtual Pages with the help of Google Tag Manager and Google Analytics. If you don’t know what Virtual Pages are and learn more about how they can help you especially if you are tracking a Single Page Application, I suggest you to read my dedicated post. To […]
- Google Analytics 4: Cross Domain TrackingIn this post I’ll show you how to implement cross domain tracking in the new version of Google Analytics 4. With GA4 cross domain tracking is much easier than the Universal Analytics version, in fact: in Universal Analytics you had to set everything up within Google Tag Manager In Google Analytics 4 you can do […]
- Google Analytics 4: Referral Exclusion ListReferral traffic is, generally, traffic from other websites that contain one or more links to your site. The new Google Analytics 4 allows you to measure this kind of traffic for your analysis, without the use of tags, triggers or variables. Proper implementation of referral traffic allows you to understand which other websites are bringing […]
- Google Analytics 4 Demo AccountGoogle has just released the Demo Account for Google Analytics 4 Now, all users can access and discover the functionalities offered by GA4. But let’s go in order! Post Content: 1) What is the Google Analytics 4 Demo Account 2) How the Demo Account is implemented 3) What can I do with the Demo Account […]
- Form tracking in Google Analytics 4In this post, I’m going to show you how to track a Form with Google Analytics 4 and Google Tag Manager. If you want to track the Lead of a user who fills out the Form on your website, firstly you must have created a new Property for GA4 and secondly created a tag in […]