Test a GTM Update

Overview

Google Tag Manager (GTM) is a script management tool for websites. It runs on every pageload and determines which other scripts should run on the page, based on which page it is and what content is showing on it.

It’s pretty intuitive so we often use it for scripts that we want to be controllable by the client. Instead of needing to ask us to make changes in the code, they can make them in the GTM interface, and the site will be updated without any code changes.

Testing that scripts are running properly through GTM is a two-part process. First you use the GTM preview helper to see that GTM is firing the right tags. Then, you want to use other verification methods to ensure that the tag is indeed firing properly, and that data are flowing the way you expect. The latter test depends on the specific tag you are testing.

What you Need

  • Access to Google tag Manager
  • Access to client website in google tag manager

Steps

Navigate to the property you are working on.
image

If you are unsure, you can look at the source of the website you are working on. If you have the right property, you will see its Container ID in the website code.

image
Activate Preview Mode

Click the preview button:

image
Navigate to the site you are testing.

No matter which environment you are looking at (Staging/Prod/Local) you should see the GTM preview pane for the site now:

image

The left panel under "Summary" shows all the "triggers" that have occurred so far during this pageload. If you click on one of them, you will see the "Tags" that have fired because of that trigger.

Validate that results match your expectations.

Depending on what you are QAing, you will want to explore the different triggers on the left to look for confirmation that the tag(s) you are testing fired appropriately.When you find the tag, click it to see the detail of what happened when it fired:

image

If anything went wrong, it can be useful to look at the Variables tab to see if there are any clear mistakes:

image
Test the scripts themselves.

Depending on what you are testing, you should now check to make sure that the script in question is actually working. For instance, with Google Analytics, use the GA chrome helper or the GTM preview pane to validate that the code is working. For social media remarketing pixels, use the GTM preview pane and the relevant service’s tools to check that things are firing appropriately.

For code with some visible effect, check to make sure that effect is actually happening. For other invisible code, you can use the console to look for global variables associated with the script. If this script is anything out of the ordinary, the person who requested this QA should have given you some sense of how it can be validated. If not, talk to them.

  • Log issues in relevant location.