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

24 November 2017 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. Once you’ve sent the pageview, you can use Leadfeeder to track them, too.

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.

Setting up a Goal in Google Analytics based on page URL

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.

Given that we already know who these users are (they signed up for our tool, after all!) Leadfeeder doesn’t really give us any extra information here. But what if your conversion is a video view or a PDF download? You can’t really track PDF downloads or video views in Google Analytics and that’s why you can’t track that in Leadfeeder, either. Right?

Sometimes you can’t identify your best web site visitors by the pages they visit. Video views, shares, downloads and leaving a comment are just some examples of events that you often can’t track in Google Analytics by default. How to track them?

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.

Seeing details for our link with Chrome Inspector

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 https://app.leadfeeder.com/signup?ref=blog-top-bar 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

Creating new tag in Tag Manager

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.

Creating Google Analytics variable for virtual pageview

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.

Creating Google Tag Manager 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/signup?ref=blog-top-bar AND has a class of top-bar__link-button.

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 in Tag Manager

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.

After you get the data to Analytics, you can use the pageview to create a new custom feed in Leadfeeder. This way, you can see all the companies that have done a certain event on your web site.

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 Google Analytics 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 requires a Google Analytics account and you can see results right after the sign up.

Sign up

Fresh stories, advice and updates delivered hassle-free to your inbox.

Got Google Analytics and want to know who really visits your website? Find out more.

Related articles

Leadfeeder knows who’s visiting your website

Free leads from Google Analytics. No extra script installation needed.

See for yourself

Free trial. No credit card required.

As seen in

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