Article Image

What are gtm.js , gtm.dom and gtm.load events in dataLayer for Google Tag Manager (GTM)?

GTM | Datalayer

As we know Datalayer is one of the most crucial parts of web analytics. Often we come to point of implementation and the key question is the extra events we see already existing in DataLayer.

In this post, we will understand what does each event mean and how you can leverage them out as per your requirement.

Event : gtm.js

This is the first event that gets pushed into the dataLayer which suggests that the GTM container snippet rendered in the page successfully. If you take a look into the GTM container snippet, you will find that the snippet pushes this event with the timestamp. If you want your tags to fire on the earliest possible moment, you can use the trigger condition as Event equals gtm.js.

Event : gtm.dom

This event gets pushed into the dataLayer as soon as the DOM (Document Object Model) is loaded for the given page. If you want your tags to fire after the DOM has loaded, for example if you know you have important variables processed at the very bottom of your page template, use Event equals gtm.dom.

Event : gtm.load

This event gets pushed into the dataLayer as soon as the window has loaded.

What you should avoid doing?

I would advocate not to fiddle with these events if you don't know what you are doing. You must never reinitialize dataLayer object. If you do, this will remove the linking of dataLayer object with your tag manager, and GTM won't listen to any events.