ga and _gaq both are global object used for tracking in google analytics.
The _gaq global object can be used directly for asynchronous page tracking via the push(…) method. It also has methods for creating tracker objects.
Example
1 2 3 | var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-65432-1']); _gaq.push(['_trackPageview']); |
ga use in Google universal analytics
1 2 3 4 5 6 | ga('send', 'pageview'); ga('send', 'pageview', { 'page': '/my-overridden-page?id=1', 'title': 'my overridden page' }); |
If we use ga.js (“traditional” asynchronous code) we have to use _gaq.push. If we use analytics.js we need to use ga send. The methods are not interchangeable, they belong to two different versions of the Google Analytics tracking code.
The analytics.js snippet is part of Universal Analytics which is in latest trend. while ga.js is classical analytics.