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:
- Google Analytics 4: source/medium reportOne of the most popular reports within the Universal Analytics version is definitely the Source/Medium Report. In this Report, you can quickly observe the source and medium of users landing on the website. In UA we can find it under Acquisition > All Traffic > Source/Medium The new version of GA4 offers many features but […]
- Landing Pages Report in GA4One of the most interesting reports in Google Analytics – Universal Analytics is the Landing Pages Report. In this report you can observe the first landing page of a user on the analyzed website. It’s a very useful report to quickly understand what our user’s entry points are. However, the question may arise: how do […]
- Google Analytics 4: ComparisonIn this post, I’ll show you how to compare data in Google Analytics 4. Just as with the UA (Universal Analytics) version, where you can use segments to better analyze your users’ behavior on the site, GA4 offers a similar feature. However, there are some nuances, compared to the UA version. Compare data in GA4 […]
- Search Console and Google Analytics 4In this post I will show you two things that I find very useful: Connect the Google Search Console directly to your Google Analytics Property 4 Save a widget for faster access to Search Console data in the GA4 User Interface Let’s start! How to Link Search Console to GA4 Property The steps to link […]
- How to Change Language in Google Data StudioGoogle Data Studio is a great data visualization tool that is completely free, allowing you to connect different data sources to create dashboards. Some of the available data sources are: Google Analytics Google Sheets Google BigQuery File in .csv etc. The sources are different and, as you have seen, they are not only from the […]
- How to Implement Content Group in Google Analytics 4Content Groups allow you to create sections of the website, grouping contents in a convenient way for your analysis. Let’s give some examples: I can create a specific group that shows me the most viewed Brands on my website or I can create Product categories to analyze, at a higher level, the interactions of users […]
- Server-side Tagging: what is it?Update: October 5th. Google Tag Manager Server Side is officially out of Beta, as confirmed by Google, and has entered a new phase. Announced in August 2020, Google Tag Manager Server-side is still a tool / theme unknown to most. There are many doubts and questions on the subject and in this post I want […]
- Content Grouping in Google AnalyticsNote: this article refers to the Universal Analytics version. If you want to know how to implement Content Groups in GA4 via Google Tag Manager, you can read this blog post. Analyzing the contents of a website, has it ever happened to you that you want to know what are the performances of the main […]