• GTM Courses
  • Blog
  • Services
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
  • About
    • About
    • Contact
  • GTM Courses
  • Blog
  • Services
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
  • About
    • About
    • Contact

January 13, 2021

Missing DOM Ready and Window Loaded events in GTM?

Published: January 13th, 2021

This will be a very quick guide and it’s based on one of the recent posts in the GTM community on Facebook.

One of the members faced a situation where DOM ready (a.k.a. gtm.dom) and Window Loaded (a.k.a. gtm.load) were missing in the Data Layer although the Container Loaded event (gtm.js) worked just fine.

Simo Ahava’s eagle eyes spotted a weird thing that was implemented on a site. For some reason, an empty array was being pushed to the Data Layer, like this (which is not a valid command for GTM):

If you want to push data to the Data Layer, it must be an object or a command array. And an empty array is neither of those.

So what must be done? You have to cooperate with a developer and ask him/her to remove the dataLayer.push that adds an empty array. Or disable a plugin that is doing so (if you are working with a popular website builder/ecommerce platform.

Unfortunately, there is no universal “go here, click this” answer. Websites are different and most of their codebase is different. So you should probably cooperate/consult with a person/company that is responsible for building that website.

 

Still missing DOM Ready and Window Loaded events?

If this tip did not help you, leave a comment below and we’ll try to find a solution + update the guide. And if this indeed worked well, consider subscribing to my newsletter by getting one of these ebooks.

Google Tag Manager Ebook Bundle
Julius Fedorovicius
In Uncategorized
0 COMMENTS

Leave a comment Cancel reply

Your email address will not be published. Required fields are marked *

 

Hi, I'm Julius Fedorovicius and I'm here to help you learn Google Tag Manager and GA (but mostly GTM). Join other 100 000+ monthly visits and 14000+ newsletter subscribers in this exciting journey. Read more
Essential resources


Popular articles
  • 🔥 GTM Form Tracking: 7 Effective Methods
  • 🔥 dataLayer.push: The Guide
  • 🔥 GTM vs Google Analytics
  • 🔥 99 Things You Can Do with GTM
  • 🔥 Common GTM Mistakes
  • 🔥 Data Layer: Ultimate Guide
  • 🔥 60+ Custom JavaScripts for GTM

Early-bird discount expires:

Days
Hrs
Min
Sec
Analytics Mania
  • Google Tag Manager Courses
  • Google Tag Manager Recipes
  • Google Tag Manager Resources
  • Google Tag Manager Community
  • Login to courses
Follow Analytics Mania
  • Subscribe to newsletter
  • RSS feed
Recent Posts
  • Track Contact Form 7 with Google Tag Manager
  • Missing DOM Ready and Window Loaded events in GTM?
  • The most up-to-date GTM course is here
Analytics Mania - Google Tag Manager and Google Analytics Blog | Privacy Policy
Manage Cookie Settings