FAQ Database Discussion Community

Google Tag Manager and dataLayer interraction

I use GoogleTagManager script and dataLayer object. I read in documentation that dataLayer object has to be filled above the GTM script. But I need to add a product detail when the user chooses the product and it happens after the GTM script is loaded. If I use dataLayer.push(chosenObject) will...

Position of event in data layer - does it matter?

I have piece of GTM code in which event is sometimes placed at the top of the object and sometimes at the bottom. Now the question is, is there any difference (like one sending data from previous event) and which is the right way to handle it? dataLayer.push({ 'event': 'addToCart',...