Reputation: 504
I need to implement some universal analytics events using google tag manager and I faced some problems. I have added google tag manager snippet whick looks like that:
<body>
<script>
var dataLayer = [];
</script>
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
<!-- Google Tag Manager -->
As you can see i added the snippet right after the body tag.
And somewhere lower in the code i added dataLayer event push:
<div class="feature_Box one">
<a class="feature4 element" href="#" onclick="dataLayer.push({'event':'VirtualPageview', 'VirtualPageURL':'/cust-tracking/feature/a4','VirtualPageTitle':'featureBox'});_gaq.push(['_trackPageview', '/cust-tracking/feature']); return false;">
blahblah<br><strong>blah blah</strong> <span></span>
</a>
</div>
I also have to leave the old google analytics _gaq.push()
.
So when I try testing my dataLayer event with firebug it does not fire no parameters onclick, only the gtm(when page loads) having only id and old one from _gaq.push().
I have no access to gtm configuration interface and have to implement events beforetesting so i did not set any specific rules. Can it be because of that or it still should be visible through firebug that it is firing something?
Upvotes: 2
Views: 1614
Reputation: 662
Are you running any adblockers? To confirm ad-blocking is your issue, use Chrome, F12 Network and look for this message:
GET http://www.google-analytics.com/analytics.js net::ERR_BLOCKED_BY_CLIENT
If you see that, disable your adblocker (hopefully your colleagues won't laugh as hard as mine did).
Upvotes: 3