Mon, May 20, 2019
If you’ve worked with Google Tag Manager, you’ve definitely come across the Page View (All Pages) trigger — for example, when setting up Google Analytics 4 or Facebook Pixel. Many people mistakenly believe that this trigger listens for the page load event, but that’s not entirely true. In fact, Page View
is an event that gets pushed to the dataLayer at the moment the GTM container loads (event name: gtm.js
).
In other words, when you use the Page View trigger, you're telling GTM to fire your tag immediately after the container loads — without waiting for the full page to load. If you want to fire a tag after the DOM has loaded or after all resources have finished loading, there are other triggers in the Page View category for that:
gtm.dom
)gtm.load
)And if you think the difference between these triggers is minor, take a look at the screenshot below: the time gap between the first and last event is more than 5 seconds.
When configuring tags, use the All Pages trigger as intended: to fire the tag on every page where GTM is installed, and as early as possible in the page load process. Examples of tags that might use the All Pages trigger include the Google Tag or a script that tracks the traffic source to your site.
If you want to run a script that interacts with the DOM — for example, to listen for a form field input — you’re better off using DOM Ready or Window Loaded. Otherwise, you might try to attach a listener to an element that doesn’t exist yet.
Recently, Google has also given us more flexibility when it comes to firing triggers like Scroll Depth or YouTube Video. Now, you can choose when the trigger should be activated: right after the container loads, after the DOM is ready, or after all page resources are fully loaded.
I’m confident you’ll make the right choice after reading this article.
If you’re still unsure which Page View trigger to use in a particular situation, describe your case in the comments — I’ll be happy to help.
If you enjoyed this content, subscribe to my LinkedIn page.
I also run a LinkedIn newsletter with fresh analytics updates every two weeks — here’s the link to join.
Web Analyst, Marketer