GTM how data Layer is pushed to the GTM portal?

1.1k views Asked by At

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?

1

There are 1 answers

2
Eike Pierstorff On BEST ANSWER

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.