Question

I am trying to use GTM for my website. I have initialized the dataLayer variable like this:

dataLayer = [{
'pageCategory': 'signup',
'visitorType': 'high-value'
}];

Now I have triggered the request to gtm.js Now, I make another push to my dataLayer onclick of a button.

<a href="#" onclick="dataLayer.push({'event': 'GAEvent','pageURL': '/link-click/'});">Click Here...</a>

I could see that the dataLayer variable is appended tothe new object . However, I could not see any request being triggered to GTM portal in my console. I am not able to understand How, the new object(pushed during click event) is communicated to the GTM portal?

Was it helpful?

Solution

It isn't.

Everything you configure in the GTM interface is packed into a javascript function, embedded into your page and evaluated/executed in the scope of your page. Once the GTM script has loaded it is not necessary to transmit anything to the GTM site.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top