SEO – How To – Install Google Tag Manager and Conversion Tracking
Purpose of this How To Guide: To understand why conversion tracking is needed, and how to implement and test it
Applicable to: Social and Paid Media, SEO, Leads (Please note this Guide sits between SEO and PPC)
Customers: All
Timescale: No set timeframe, applicable when tracking is required.
Introduction
If relevant and applicable, you may be required to install Google Tag Manager and conversion tracking for a customer. Having conversion tracking allows us to record valuable actions taken on a customer’s website, which can be used to measure performance and improve optimisation.
Time Allocation
The time needed for this task will dependent on the amount of tracking required, complexity of the tracking, and Google Tag Manager implementation. This time will need to be logged against the task you are assigned within the customer’s monthly contract (if applicable), for Social & Paid Media you will log this against your retainer tasks.
Destination Tracking
This is the simplest of all conversion tracking, if your customer has a particular ‘thankyou’ page (after submitting a contact form for example) you can set that page’s URL as the destination goal, therefore every person that visited that page will register as a converted user.
Event Tracking
This is more complex than the above Destination Tracking, and will require you to follow the upcoming sections.
Google Tag Manager (GTM) Integration
You will need to check with DND whether we host the website first, if not you will be required to send this to the customer’s developers.
Google Tag Manager is required to easily install a code on the website for conversion tracking purposes. To get the code to install GTM, you need to visit https://tagmanager.google.com/ and click ‘Create Account’. Run through the setup here and it will give you the HTML code required to install the container on the website.
There are multiple website platforms that we commonly work with, each requires a slightly different approach to implementing the GTM code:
- SQShop – Installed via FTP
- WordPress (Including WooCommerce, Shopify etc) – Installed via FTP or by using the ‘DuracellTomi’ plugin (recommended)
- Magento – It’s unlikely our developers will be able to help with this one, so it will require you asking the customer/Account Manager how to proceed
If you are unsure how to best install the code onto the website or what type of website it is, please contact one of our developers, who will then be able to help you.
Google Analytics
This is where the conversion tracking will be recorded, with goals needing to be created on this platform to match what is installed in Google Tag Manager.
This will need to be linked with the GTM container, which will be explained in the ‘Defining Variables’ section below.
Defining Variables
In order for your conversion tracking to ‘fire’ on a website, we will need to first define a number of variables that will be used as a conversion ‘trigger’.
As a rule, you should Configure the checkboxes for the below ‘Built-In Variables’:
Clicks
- Click Element
- Click Classes
- Click ID
- Click Target
- Click URL
- Click Text
Forms
- Form Element
- Form Classes
- Form ID
- Form Target
- Form URL
- Form Text
You may be required to enable other built-in variables; however this will depend on the scenario you or the customer are looking to track.
Under ‘User-Defined’ Variables, you will need to configure a new Variable, choosing ‘Google Analytics Settings’ under the ‘Utilities’ sub-section. You simply need to enter the Tracking ID of the Analytics property you want to link, found in Google Analytics ‘Admin’ > ‘Tracking Info’ > ‘Tracking Code’.
Tag Creation
This is where we determine what our conversion is going to be.
For the purpose of most conversion tracking undertaken at SQ Digital, you will be selecting ‘Google Analytics – Universal Analytics’ as your ‘Tag Type’, and you will want to set the ‘Track Type’ to ’Event’.
This portion of conversion tracking must be mirrored in Google Analytics to ensure the conversions are recorded correctly within that platform.
You will need to fill in three fields: Category, Action and Label. Make sure these match exactly what you will input within Google Analytics, which you will find under ‘Admin’ > ‘Goals’.
Category you will input ‘Button’ (without apostrophes), Action will be ‘Click’ and Label will be a unique identifier to what you are wanting to track, for example, ‘Contact Form Submission’ .
Within Google Tag Manager, under the ‘Google Analytics Settings’ box, choose the Analytics variable you created earlier.
Trigger Creation
This is where we determine how our conversion is ‘fired’.
Given that we are tracking events on a website, we need to determine when that valuable action occurs. The most common scenario is a contact form being submitted, so that is what will be used for this example (assuming the contact form does not have a thank you page).
Under ‘Triggers’, you will need to create your own custom trigger, through the blue ‘+’ button.
In this scenario, you will then choose ‘Click’ > ‘All Elements’. Following this, we will then choose ‘Some Clicks’. This is where we will use the variables created earlier and will commonly be the ‘Click Classes’ or ‘Click ID’ event.
You will need to inspect the element on the website you are tracking at this point (right click on the button, then choose ‘Inspect’. The console will open up with the HTML file for the page, and you will need to look for the ‘Class’ or ‘ID’ of the button here (If the button does not have a Unique class or ID selector, and there are multiple forms on the website, you will need to ask developers to add a unique ID selector.
Copy the class/ID of the button, and paste this into Google Tag Manager, changing the middle box to ‘Equals’.
Repeat both Tag and Trigger steps for each form/action you are looking to track on the website. This will track every time the submit button is clicked.
Conversion Tracking Testing
To ensure conversions are being recorded accurately as they should be, we will then trial pushing the code to the website and manually undertake our conversion action. To do this, simply click the ‘Preview’ button in the top right of GTM, which will temporarily push the new workspace within the container to the website. Once here, you will need to head into Analytics, and then choose ’Real-Time’ > Conversions. (Make sure to remove the respective SQ IP filter of the building you are working in. If you need help with this, consult Google or another member of Digital Marketing team).
Hard-Refresh the website you are working on (CTRL + F5) and make sure both the GTM ‘debug’ window appears on the website, along with your session being recorded in Google Analytics (Real-Time > Overview/Location)
Here, you simply need to test the conversion you expect users to take, i.e. filling out a contact form or clicking an email address.
Troubleshooting
If your conversions are not working/recording accurately, you will have two main steps to take.
- If the ‘debug’ container on the website is not showing that your tag fired, there is an issue with your trigger.
- If debug says the tag fired, but this isn’t recorded in Google Analytics, there is an issue with your tag or Analytics configuration.
In scenario 1, you will need to revisit your trigger and ensure the class/ID is correct, amending where necessary. If you are using a Class Selector, ask our developers to implement an ID selector and use that as a trigger.
In scenario 2, ensure your GTM and Analytics categories are the same, if not then amend where applicable. If they are correct, ensure there isn’t a filter on the Analytics account preventing the cookie from detecting you as a user. Finally, if that does not work, try using a different device, ideally with a different IP address (a computer in the other building, or your mobile device).
Publishing Changes
If the testing stage concludes your conversion tracking is working correctly, you are ready to ‘push’ your changes to the live website. To do this, simply leave your preview mode on GTM, and click the blue ‘Submit’ button. Name your container with a good description that accurately represents the work that has been carried out.
For example, the title may be ‘contact form submission tracking’ and the description may be ‘set up event tracking on submission of the contact form on ‘X’ page.
Pushing Conversions to PPC (if applicable)
If there is a PPC account for the customer, ensure the PPC Executive imports the conversion tracking into the Google Ads account.