Written by 5:22 pm Google Tag Manager

Testing How and When Tags Fire in Google Tag Manager

Testing your tags and triggers through GTM’s ‘Preview mode’ is a great way to iron out any kinks with your setup.

December 22nd 2019

If you’re just starting out in using Google Tag Manager, you should be familiar with ‘Preview’ mode, or in other words, the testing functionality whereby GTM allows you to take a look at how your shiny new tags fire before you publish the container. It’s a great way to iron out any mistakes or tweak your triggers. (If you’re not that familiar, you may want to have a read of this guide on the basics of GTM and why you need it).

So what is it? Well, preview mode essentially lets you see ‘under the hood’ of your website and which pixels are firing and where, it also allows you to view elements of other variables, such as button classes or data layer variables, effectively all of the things that go on behind the scenes, but more on that for another post.

So go ahead and hit preview, you’ll see a message appear once the page has reloaded:

gtm preview screen

When this appears, it means you can head over to the website where this container is, and preview all of those nice things you’ve just implemented. From this dialogue box, you can leave (or in other words, close the preview session) or you can ‘Share Preview’ this will give you a link to send to anyone you wish (perhaps you may need to give this to a colleague or manager). On your site, you should now see your website in GTM preview mode:

gtm preview summary

On this particular example, you’ll see what tags have been fired on the page, and which ones have not, typically on most websites you should see Google Analytics firing on every page, providing you’ve set your GA tag to fire on all pages of course. As you navigate through your site you’ll see all of the tags firing which will give you an insight into any changes you’ve just made, if a particular tag isn’t firing on the page that you want, it’s likely that you’ll have to adjust the trigger, or create a new one for that particular tag. To do this, head back to the GTM container, make the change, refresh the preview message pane (this is the orange box above), then refresh the tab where your website is open.

Benefits to GTM Preview Mode

This can save you a lot of time in going back and forth with a client (if you’re an agency or freelancer), it can also save you money in testing certain tags, mainly conversion tags that rely on pushing metrics towards ad platforms, if they don’t fire correctly, lots of advertising cash could be spent in the time it takes to figure out something isn’t quite right.

Common Issues With GTM Preview Mode

The most common issue is users not seeing the preview pane on the site once it’s in preview mode, this is likely because the container isn’t visible on that page, check with the developer, or your CMS plugin to ensure GTM is in the head of the website and visible on every page.

Another common issue is the preview mode appearing every time you visit the site! This is particularly annoying for someone else if you’ve sent them the preview link. Always make sure you leave preview mode once you’ve completed your testing and either come back to it later or publish your changes if you’re happy.

There are several advantages to previewing your tags, and there’s lots of really interesting things you can do, such as viewing elements of a button in order to fire marketing tags on a click (one for another post), but when firing tags on URL based rules, this is the ideal tool to ensure everything is working as it should.

For more about GTM and to get started on installing a container on your site, head over to the official website here.