I created a Google Tag Manager data level variable and published a container. When I access the page, I get an error in the Chrome console
dataLayer is not defined
Pressing the datalayer script is in the HEAD element, and the GTM code snippet is in the Body tag.
If you are trying to use dataLayer, you need to make sure that it is defined before using it:
window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'someKey': 'someValue' }) // GTM Container here
Source: https://habr.com/ru/post/1651300/More articles:How can I make my modified tabbable switches? - htmlFormat std :: time output - timeHow do pipes work in Rust By Example? - multithreadingRun the void installation method in Spring Context @ Configuration - javaHow to count 5 minutes? - rustFailed to load download file to store files running python-eve - storageHow to get instances in recursion schemes - haskellWhy does the void method get a NullPointerException on the mocked object? - javaИспользование Sweet alert с классом Typescript - javascriptQThreadPool backup example - qtAll Articles