Step-by-Step: QA Your GTM Container with Preview and Debug Mode
Previously, I’ve showed you how to implement a basic Google Analytics page view tag, event tags, and outbound link tracking using Google Tag Manager. An important step prior to publishing any tag in GTM is to QA the tag prior to publishing. You can do this with the ‘Preview and Debug’ mode in GTM. This functionality can help ensure that your tags are firing correctly, as well as highlight any potential discrepancies in the tag setup prior to publishing to your production environment.
This is a quick process that you can accomplish in just a few steps:
Setup your tag. In this case, I’m testing a new pageview tag called ‘gaPageview Test’ on this blog, kristaseiden.com. You can see the tag and trigger setup here:
You’ll see the below notification across the top of your GTM interface when in Preview & Debug mode:
Navigate to your live website. You should see the GTM debug pane at the bottom of your screen. In the Summary pane, it will show each of the tags that fired on page load (or other action you’ve taken), and those that did not. In this case, we see that my gaPageview Test tag did not fire as we expected it would.
If tags are firing as expected, you’re good to go and can close out the preview mode, create a version and publish. If the tags are not firing as expected, as in this case, you’ll need to figure out what’s wrong.
When I created the trigger for this tag, I set it to ‘equal’ kristaseiden.com, however, I now realize that will mean if www.kristaseiden.com is loaded, this tag will not fire. To fix this, I’m going to change the trigger to ‘contains’ instead of equals, like this:
Once I’ve made this update, I can re-test if the tag is firing using the Debug pane again:
Now this time I can see it’s firing as intended, which means it’s now time to publish!
There you have it, 4 easy steps to Preview & Debug a tag in GTM to ensure it’s firing as intended before you publish.