#GTMtips: Use The All Pages Trigger Correctly
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.
For more information about Triggers, be sure to read my Trigger guide as well!