Question

I am working on a website, and i want to do record event event on the website. for that i have searched on Google and found Event Tracking. but i how to check whether i am using ga.js or analytic.js and which is better to use and why. My google Analytic code is:

<script type="text/javascript">
              var _gaq = _gaq || [];
              _gaq.push(['_setAccount', '[TRACKING_ID]']);
              _gaq.push(['_setDomainName',document.domain]);
              _gaq.push(['_setAllowLinker',true]);
              _gaq.push(['_trackPageview']);

              (function() {
                var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
               ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
              })();
            </script>

please help me.

Was it helpful?

Solution

Universal Analytics does not use the .push syntax. Instead, it has a function ga().

You apear to not be using universal analtyics you should check this link on how to work with Event Tracking: Event Tracking - Web Tracking (ga.js)

This link should help you understand the diffrence: About Universal Analtyics

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