#GTMtips: Use the All Pages Trigger Correctly

How to use the All Pages trigger in Google Tag Manager.

Here’s a very quick tip this time, but one that’s caused a lot of headache for many Google Tag Manager users.

Tip 21: Use the All Pages Trigger correctly

Let’s face it, All Pages isn’t really an intuitive Trigger name. Many seem to interpret it as: enable the Tag to fire on all pages, but use the other Trigger (e.g. Link Click) to actually fire it.

As it turns out, the All Pages Trigger will fire the Tag on all pages. And it does so instantly, as soon as the GTM library has loaded. This means that a Tag such as the one in the screenshot above will fire twice:

First when the gtm.js event is triggered in dataLayer upon the loading of the container snippet.

Again when the second, Event Trigger is activated upon a Link Click.

You might have guessed by now that only the second Trigger is relevant here. If the Event Tag is using Variables like Click URL or Click ID in its fields, these fields will most likely return undefined or (not set) in Google Analytics when the All Pages Trigger fires. This is because at the time of the All Pages event (gtm.js), no click has yet been registered, and these Variables will resolve to…nothing.

So, my friends, use the All Pages Trigger as it’s supposed to be used: to fire a Tag on every single page with GTM installed on it, at a very early stage in the page load sequence. Examples of Tags that might use the All Pages Trigger would be the Google Analytics Page View Tag, some very open-ended remarketing Tag, Custom HTML Tags which setup a JavaScript framework for the rest of the Tags to use, and so on.

For more information about Triggers, be sure to read my Trigger guide as well!