I'm trying to create a dataLayer for my website and I have this problem. As i understand: Google Tag Manager dataLayer works that way so you have one dataLayer object with all the data variables. And everytime you use dataLayer.push it will add more data to your dataLayer object. In my case it creates the separate objects. Here is a screenshots how it looks:
So the first object is my dataLayer, here is code:
And the 4th object is one more dataLayer created with dataLayer.push which suppose to be added to existing one if I understand correctly.
So instead of having one object I have 2 and if I add more .push methods I will have even more objects.
So how do I have all my dataLayer.push pushing to my main dataLayer instead of creating an extra objects?
Please have a look and point if I'm missing something important, I'm new to this and can't understand why don't I have one complete dataLayer object in the end.
I'm new to this and can't understand why don't I have one complete dataLayer object in the end.
Cause that's how dataLayer and GTM works :) Everything looks fine on your screenshot. Each dataLayer.push
should add additional object (datalayer is an array of objects).