Skip to content

Instantly share code, notes, and snippets.

@eduardo-matos
Last active June 13, 2016 14:48
Show Gist options
  • Save eduardo-matos/5152004 to your computer and use it in GitHub Desktop.
Save eduardo-matos/5152004 to your computer and use it in GitHub Desktop.
Loading Google Analytics using Dojo Toolkit (1.8+)
require([
'dojo/request/script'
], function(
script
) {
'use strict';
var _gaq = window._gaq = window._gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
var src = ('https:' == window.document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
script.get(src);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment