How to add any event as a conversion to Google Analytics and Leadfeeder with Google Tag Manager

How to add any event as a conversion to Google Analytics and Leadfeeder with Google Tag Manager

04 September 2020 by

In this post I will talk a little on what is a conversion, why it’s important and how you can use Google Tag Manager to send any web site event as a page view to Google Analytics.

What is a conversion?

Conversions should be the center piece of your web strategy. You are never only interested in getting more visitors, you are interested in getting more visitors that are somehow valuable to you and your company. In the web analytics world this value is often measured in conversions.

What is this conversion then? For us at Leadfeeder it’s the sign up, for example. We want our visitors to sign up for our tool. So, whenever someone visits the last page of our sign up funnel we know they’ve converted, that is, signed up.

Conversion by page URL

If your conversions are based on the page URL setting up conversions is simple. All you have to do is to go to your Google Analytics settings and create a new Goal and use Destination in Goal details to set up your URL.

analytics conversion

We can track this in Leadfeeder, too, of course. All we have to do is to create a new custom feed based on the Page URL and use this page as the filtering criteria. This Custom feed will then show only those leads that have converted.

Virtual page views in Google Tag Manager

One neat trick that Google Tag Manager brings is 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.

You can use any triggers you would assume in Tag Manager. A link click, the new video watched percentage or a custom JavaScript event if you so like.

By the way, while you could also use Events to do this, one major benefit you get with pageviews is that you can create funnels for your conversions. For example you could create a pageview in once 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 lot nicer view on how your videos are watched.

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-button or the link destination or even the text Sign up.

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, you’ll have to make a trigger - a rule that says when you want to send the pageview. The other will be the actual 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

gtm step1

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.

gtm step1

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 page and title and type in the URL and title respectively. Save your new Analytics variable.

Now we 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 class

Click on the plus icon on top right. Now we need the details from the button that we got from Chrome Inspector.

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.

built in variables

Now you have a new tag that fires on all clicks that match our identiers. 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: I’ve seen several times that the virtual pageview is not visible in Google Analytics real-time tool. If you can’t see visits in Real-Time view even if everything seems correct in Tag Manager debug, use today’s data in normal reports.

But now you probably want to see which companies see your video or download your white papers, so you probably have some GTM and Leadfeeder setup to do. See you later!

Now that you're here

Leadfeeder is a tool that shows you companies that visit your website. Leadfeeder generates new leads, offers insight on your customers and can help you increase your marketing ROI.

If you liked this blog post, you'll probably love Leadfeeder, too.

Sign up

Leadfeeder knows the companies visiting your website

Install today to start identifying new business opportunities.

See for yourself

Free trial. No credit card required.

As seen in

  • Forbes
  • Entrepreneur Magazine
  • Fox
  • Mashable
  • Social Media Examiner