Sometimes you can’t identify your best website visitors based on only the pages they viewed. Instead, video views, shares, downloads and leaving a comment are just some examples of events that would be good indicators. However, you can’t track these actions in Google Analytics by default, which means you can't track these actions in Leadfeeder either. Here is one trick around this!
Virtual page views in Google Tag Manager
One neat trick that Google Tag Manager allows is the ability to send virtual pageviews. Virtual pageviews are pageviews that are not actually pageviews. They can be triggered by any user action or other event, and once they are triggered, a pageview is sent to Google Analytics.
(Side note: while you could also use "Events" to accomplish this, one major benefit you get with pageviews is that you can create funnels for your conversions. For example you could create a pageview once a user starts a video, then another pageview once they’ve watched 50% of the video and then a third pageview when they’ve finished the video. This gives you a more complete view on how your videos are being.)
This pageview will show up as a regular pageview with URL and page title (if you want) and all other metrics you are accustomed to seeing with pageviews. Because they are just like regular pageviews, setting up conversions is as simple as in the previous example.
Setting up virtual pageviews
Let’s set up a virtual pageview for a button click. First, we need to identify which button or buttons we want to use for this trigger. We can use Chrome Inspector to see our identifiers.
In this example, we could probably identify the sign up button in the top right corner by using the classes
button top-bar__link top-bar__link-buttonor the link destination
https://app.leadfeeder.com/f/sign/up/start?ref=blog-top-bar or even the text
Which identifier(s) you want to use depend on your setup. I would suggest using CSS classes or identifiers, but sometimes link target or text are better.
To send pageviews from Tag Manager, you’ll have to do 2 things first:
- Create a trigger - a rule that says when you want to send the pageview.
- Create a pageview tag, where you can define details of the pageview (title, url etc).
And because of how Tag Manager and Analytics work together, you’ll actually need a third thing, too: an Analytics Variable in Tag Manager:
Tag Manager setup
- Go to "Tags" and "Create a new tag."
- We want to fire an Analytics pageview, so in “Choose tag type” select Universal Analytics.
- We are creating pageviews, so in Track Type select Pageview.
- After that, create a new Google Analytics variable in Google Analytics settings.
Type in your Tracking ID (hint: you should be using a Tag Manager variable for this) and select
Fields to set. We want to send URL and page title, so select
title and type in the URL and title respectively. Save your new Analytics variable.
Now, we'll have the correct Analytics tag that sends a pageview whenever it’s triggered. We haven’t yet setup a trigger though, so it won’t fire ever. Let’s fix this.
In the tag creation screen in the bottom you have a section called Triggering. Click on the section to select triggers.
Click on the plus icon on top right. Now, we need the details from the button that we got from Chrome Inspector.
You can even combine triggers as in the example. In this example, a tag is fired when someone clicks on a link that goes to
https://app.leadfeeder.com/f/sign/up/start?ref=blog-top-barAND has a class of
If you can’t see Click Classes or Click URL in the list, you’ll have to activate them first. They are called Built-in Variables and you can activate them in Tag Manager left sidebar “Variables”, clicking Configure and selecting the ones you want to activate. There are some very useful ones such as Video Title or Video Percentage that you might want to activate too.
You'll now have a new tag that fires on all clicks that match our identifiers. When fired, the tag will send a pageview that has URL and name like you set up. You can use the Tag Manager preview tool to check that everything works.
(Note: we’ve seen several times that the virtual pageview is not visible in Google Analytics' real-time tool. If you can’t see visits in the Real-Time view even if everything seems correct in Tag Manager's debug tool, use today’s data in normal reports.)
Create new custom feed in Leadfeeder based on "page URL" to track which companies are performing certain actions on your website!