Where should I put dataLayer creation code in the page? Is it mandatory to put it above the GTM snippet?
Where should I call the dataLayer.push() function? Should it always be put in the code were the dataLayer creation code is placed like below?
<script>
dataLayer=[{‘Pcategory’:’login’,‘Pno’:1}],
dataLayer.push({‘Pcategory’:’login’,Pno:1});
</script>
Is it mandatory to declare an event for each dataLayer we push?
Is it mandatory to declare the dataLayer before we call dataLayer.push() function or does GTM provide a built in dataLayer?
Where should I put the code below? If I want declare it, how can I do it?
<a href="#" onclick="dataLayer.push({'event': 'GAEvent','pageURL': '/link-click/'});">Click Here...</a>