From 194dbb4a501f2912ac9f46e7e2cfc6e99e3c7246 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Tue, 13 May 2014 16:34:31 +0200 Subject: Load GA tracker with requirejs --- js/slide-deck.js | 19 +++++-------------- js/slides.js | 6 +++--- 2 files changed, 8 insertions(+), 17 deletions(-) (limited to 'js') diff --git a/js/slide-deck.js b/js/slide-deck.js index 266de5c..f5d21c6 100644 --- a/js/slide-deck.js +++ b/js/slide-deck.js @@ -808,20 +808,11 @@ SlideDeck.prototype.loadTheme_ = function(theme) { * @private */ SlideDeck.prototype.loadAnalytics_ = function() { - var _gaq = window['_gaq'] || []; - _gaq.push([ '_setAccount', this.config_.settings.analytics ]); - _gaq.push([ '_trackPageview' ]); - - (function() { - var ga = document.createElement('script'); - ga.type = 'text/javascript'; - ga.async = true; - ga.src = ('https:' == document.location.protocol ? 'https://ssl' - : 'http://www') - + '.google-analytics.com/ga.js'; - var s = document.getElementsByTagName('script')[0]; - s.parentNode.insertBefore(ga, s); - })(); + window._gaq = window['_gaq'] || []; + window._gaq.push([ '_setAccount', this.config_.settings.analytics ]); + window._gaq.push([ '_trackPageview' ]); + + requirejs([ 'analytics' ]); }; // Polyfill missing APIs (if we need to), then create the slide deck. diff --git a/js/slides.js b/js/slides.js index bfef324..143dac2 100644 --- a/js/slides.js +++ b/js/slides.js @@ -7,6 +7,8 @@ require.config({ 'modernizr' : 'modernizr.custom.56571', 'prettify' : 'prettify/prettify', 'hammer' : 'hammer.min', + + 'analytics' : 'https://www.google-analytics.com/ga' }, shim : { @@ -16,6 +18,4 @@ require.config({ } }); -require(['slide-deck'], function(someModule) { - -}); +require(['slide-deck']); -- cgit v1.2.3