I'm using Angulartics to implement events and tracking on my site.
See: https://github.com/luisfarzati/angulartics
We're currently injecting the analytics tracking code with GTM. If we don't inject the snippet, there's no traffic visible in Analytics.
See snippet:
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXXXX', 'auto');
</script>
The events are sent and everything seems to work in GTM. We don't need to use
ga('create', 'UA-XXXXXXXXX', 'auto')
in the injected code because the UA ID is already set in GTM, so there is some magic Google is doing with linking up GTM with analytics.
Basically, without (//www.google-analytics.com/)analytics.js loaded, we see no traffic.
I thought this would work, but clearly it doesn't.
Can anyone help me out with this?
Thanks