How to track conversions with GTM

Do your website visitors convert into leads or sales? Find out with Google Tag Manager

As a business, you probably have a set budget for digital marketing. But if you’re not tracking your conversions, you’re not measuring your return on investment. Rather than guessing if your digital marketing strategies are working for you, use conversion tracking to measure your success. Doing so will not only make you more comfortable with increasing your budget, but you’ll also have a better idea of what works and what doesn’t.

There are various reasons why you might want to track your visitor conversions. Some examples would be:

  • You run an online ad campaign and are looking to see what keywords are converting into leads or sales and what keywords you should remove.
  • You pay for advertising on a website and want to see if the visitors gained through the source are completing actions such as submitting their contact details.
  • You’re running A/B testing on your website and are trying to find out which designs and layouts convert better.
  • You’re measuring how many people add a product to their basket but don’t check out.
  • You’re running different marketing promotions and need to collect statistics on your ROI.

There’s plenty of reasons why you might add conversion tracking to your website, but the outcomes are the same. You’re measuring which visitors convert and which ones don’t. This data is invaluable to any business looking to increase growth via its marketing strategy.

One way of tracking your conversions is with GTM (Google Tag Manager). It’s free to use and you can integrate it with your Google Analytics account for better data insights. To get started, you’ll need a Google account. You probably already have one if you’re measuring your traffic flow to your website.

To get started with GTM, use the following link.

Setting up the account is straight forward and Google will walk you through the process.

First, you’ll land on this page.

Now click on ‘Create Account’.

On the next screen, we’re going to add a new account. Name the account appropriately, select your country, enter your domain under ‘container name’ and lastly choose your target platform. For this guide, we’ll be setting up tracking conversions on our website, so we’ve chosen ‘Web’ as the target platform. Once you have done this, click ‘Create’.

You’ll be presented with the Google Tag Manager Terms of Service Agreement. Accept at the bottom of the page and click on ‘Yes’ at the top of the screen to proceed.

A popup will now display with two pieces of code snippets that you’ll need to add to your website so Google is able to track your events. The first snippet of code will need to be added to the head of your website. The second snippet of code will need to be added immediately after the opening body tag. It’s probably best at this stage to ask whoever manages your website to do this for you.

Some content management systems such as WordPress will have a plugin you can install to simplify the process. As all CMS’s are different, you’ll need to do a quick search to see what integration methods are available for your setup.

If you want to ensure everything is working correctly, you can install a Chrome extension called Google Tag Assistant. Once installed, open the Chrome browser, navigate to your website and click on the extension in the Chrome toolbar. A popup will display and should show you Google Analytics and Google Tag Manager. If everything is green, you’re good to proceed.

Now that you have added the snippets of code and we know it’s tracking correctly; close the window and you’ll be presented with the main GTM dashboard.

Towards the top left of the dashboard, click on ‘Add a new tag’ to start. Hover your mouse over the top of the two boxes, named ‘Tag Configuration’ and click on the pencil icon.

Now we are going to choose our tag type. For this guide, we’re going to select ‘Google Analytics: Universal Analytics’.

Next up is ‘Track Type’. There are several options here. If you have a ‘thank you’ page (normally found on e-commerce checkout pages or contact form submissions) this type is particularly useful. For the purpose of the guide, we’re going to choose something slightly more complex, and go for ‘event’.

Under ‘Action’ type ‘Submit’ and leave everything else as default, except for ‘Google Analytics Settings’ where we will select ‘New Variable…’

On the next screen, you’re going to need to insert your Google Analytics tracking ID. If you’re not sure what this is, navigate to your website and right-click somewhere on the page and choose ‘View Page Source’. This will open a new window with the webpage’s source code. Click CTRL+F which will open a search box, and type ‘UA-‘.

Now copy and paste this code into GTM and click ‘save’.

We’re done with the first half. Now it’s time to set up the trigger. Click the pen icon in the ‘Triggering’ box.

In the top right corner, click the plus symbol to create a new trigger. Now click the pen icon again which will open a new window.

For the purpose of this guide, we’re going to choose ‘Element Visibility’

Under the selection method, we’re going to select ‘CSS Selector’

We now need to find our CSS selector to trigger.

The selector you use is going to be different on every website. On our website, we offer a free website audit for businesses. We have a form for this in two locations. One of them is on this page – Website Audit & Analysis.

If you scroll down the page, you’ll see a contact form. For websites that have a thank you page, we could have simply set up an event for the thank you URL, i.e. /thank-you/

As these types of pages are normally hidden from the sitemap and menu, the only way a user would normally end up on this page would be for completing an action. But this guide is for the more technical side of GTM, so we’re going to use a CSS selector. Doing this, you can replicate the triggers for any actions on your own website.

First, we need to fill in the form fields, and press ‘Get Free Report’.

You’ll notice that a new element has made itself visible. It sits directly underneath the submission button and says ‘Thank you for your message. It has been sent’.

Using the browsers developer tools, we can find the class. Right-click on the page, and choose ‘inspect element’.

On the bar, to the left of the word ‘inspector’ is a little symbol of a mouse within a browser. Select this, and as you move the mouse around the page, you’ll notice it highlights the different elements on your page. When we highlight the thank you message (the new element that appeared) it displays some code.

Now left click with your mouse, and it will highlight the associated code in the bottom left pane. We need the class only, so copy the text that appears within the quotation mark symbols. In this case, it’s the following:

wpcf7-response-output wpcf7-display-none wpcf7-mail-sent-ok

Back in GTM, we’re going to paste this into the class selector field. We also want to select ‘observe DOM changes’.

Every website is different. For us, we have more than one contact form, but they all have the same thank you message. We don’t want this trigger tracking when someone makes a general enquiry on our contact page, so we’re going to select ‘Some visibility events’ under ‘This trigger fires on’.

We’re going to choose ‘Page URL’, ‘contains’ and the part of the URL after the main domain. This way, it won’t trigger on other pages. Particularly useful if you’re tracking specific landing pages or are running ad campaigns and want to track each element individually.

Finally, click ‘Save’ twice in the top right corner of the screen.

At this stage the trigger we have created only lives in GTM. To push it live we need to click ‘Submit’ and then ‘Publish’.

Time to test.

We’re going to go to our audit page and fill in the details. After we have submitted the dummy info, we’re going to go to our GA (Google Analytics) account.

Within our GA account, on the left-hand side, we’re going to click on ‘Conversions’ – ‘Goals’ and then ‘Overview’. We can now see how many conversions we’ve had by measuring this data against our total visitors.

We can also filter the data to see the traffic sources. For example, if we have had 1 goal completed (From Google Ads) and 10 Google Ad visitors, we know that our conversion rate is 10%.

Using this type of data is the perfect way of knowing if we’re using digital marketing sources of traffic such as paid ads that aren’t converting for us as a business.

Imagine you run a Google Ad campaign and are bidding on 10 keywords.

If we can see a breakdown on which paid keywords converted and which didn’t, we’d know which ones to remove, rather than guessing.

If we’re using social media or other forms of online advertising, we’d know what worked and what didn’t.

And for A/B testing, the data is invaluable as we can start to increase our conversion rate by knowing the percentage of users that completed an action such as filling out a contact form or making a purchase against the number of visitors.

You can use GTM to track conversions and goals using a variety of triggers. You might use it specifically for tracking your Google Ad performance, or you might use it for simply seeing if a button converts better on the left- or right-hand side of the page.

If you need assistance with your digital marketing strategy, we offer on-premise marketing consultancy. Get in touch with us for more information.