GAS – A collection of power features for the Google Analytics Tracking API

Javascript / Added on December 14, 2012 / Add to favorites

GAS is a wrapper around the Google Analytics Tracking API that offers a useful collection of power features. Installing GAS is very easy – Download the script and put it somewhere on your website and then install the basic snippet on every page of your website:

var _gas = _gas || [];
_gas.push(['_setAccount', 'UA-YYYYYY-Y']); // REPLACE WITH YOUR GA NUMBER
_gas.push(['_setDomainName', '.mydomain.com']); // REPLACE WITH YOUR DOMAIN
_gas.push(['_trackPageview']);
_gas.push(['_gasTrackForms']);
_gas.push(['_gasTrackOutboundLinks']);
_gas.push(['_gasTrackMaxScroll']);
_gas.push(['_gasTrackDownloads']);
_gas.push(['_gasTrackYoutube', {force: true}]);
_gas.push(['_gasTrackVimeo', {force: true}]);
_gas.push(['_gasTrackMailto']);

(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = '//cdnjs.cloudflare.com/ajax/libs/gas/1.10.1/gas.min.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
  • YannisDran

    a description of those “power features” would be handy.. Why otherwise would I bother with it?

    hint: yes, I saw those “_gas.push”, what I say is that you should be more descriptive…