Skip to content

Instantly share code, notes, and snippets.

@tomfuertes
Last active December 25, 2015 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomfuertes/7043966 to your computer and use it in GitHub Desktop.
Save tomfuertes/7043966 to your computer and use it in GitHub Desktop.
How to include gas
<script>
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.id = 'gas-script'; // REQUIRED FOR DC.JS SUPPORT
ga.setAttribute('data-use-dcjs', 'true'); // TRUE USES DC.JS
ga.type = 'text/javascript';
ga.async = true;
ga.src = '//cdn.example.com/scripts/gas.min.js'; // REPLACE WITH YOUR SCRIPT
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment