Measure your digital success with precision and ease

MeasurementGoogle AnalyticsGoogle Tag Manager

How to Generate a Virtual Pageview on an Event in Google Analytics Using GTM

Google Analytics is an effective tool that can assist companies in monitoring and analyzing website user behavior. The capability to track events is one of Google Analytics’ key features. Events are user interactions with website content that are trackable independently of pageviews. Not every event, however, results in a fresh pageview. In these circumstances, tracking these interactions can be done using virtual pageviews. In this article, we’ll define virtual pageviews and show you how to create them on Google Analytics events.

What are “virtual pageviews”?

Pageviews that don’t actually correspond to a page on a website are referred to as virtual pageviews. Instead, they are employed to monitor how visitors interact with particular web pages’ content. Virtual pageviews can be used to monitor actions like button clicks and video plays. Website owners can track these events independently from pageviews because Google Analytics records them as if they were a new pageview.

How Can I Use GTM to Create Virtual Pageviews on Events in Google Analytics?

Using GTM, perform the following actions to create fake pageviews for events in Google Analytics:

Step 1: Create a GTM Google Analytics Pageview Tag.

The first step is to create a GTM pageview tag for Google Analytics. This will be used to send Google Analytics the virtual pageview. Click “Tags” on the GTM interface to start creating the tag. Next, select “Google Analytics – Universal Analytics” as the tag type by clicking on “New.”

Step 2: Configure the Google Analytics Pageview Tag

The Google Analytics pageview tag needs to be configured after being created. The tag type should be set to “Page View” under “Tag Configuration.” Next, select “Virtual Pageview” as the “Track Type” and enter your Google Analytics tracking ID.

Step 3: Define the Virtual Pageview URL

The virtual pageview URL must be defined next. This URL will be used in Google Analytics to track the virtual pageview. Create a new field called “page” by choosing “Fields to Set” from the list of “More Settings.” Put the virtual pageview URL in this field as its value.

Step 4: Define the Event Trigger

The final step is to define the event trigger that will fire the virtual pageview tag. To do this, go to “Triggers” and click on “New”. Select “Custom Event” as the trigger type and define the event that you want to track. For example, if you want to track clicks on a button, set the trigger to fire when the button is clicked.

Step 5: Test and Publish

Once you have completed the above steps, you can test the virtual pageview by triggering the event on your website. Use the Google Tag Assistant Chrome extension to verify that the virtual pageview is being sent to Google Analytics correctly. Once you have verified that everything is working correctly, you can publish your changes to GTM.

Best Practices for Using Virtual Pageviews

Follow these best practices to make sure your virtual pageviews are accurate and provide useful data:

  • Use page titles that are accurate and descriptive of the event being tracked.
  • To prevent confusion with actual pageviews on your site, use distinct page paths.
  • Virtual pageviews should only be used when traditional pageviews cannot be used to track an event.


Virtual pageviews are a useful tool for monitoring user behaviors on your website that don’t actually result in a pageview. You can use GTM to generate virtual pageviews on events in Google Analytics and get useful data for analysis by following the instructions in this article and abiding by best practices.


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

Related Posts