diff options
author | Pacien TRAN-GIRARD | 2014-05-13 16:34:31 +0200 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2014-05-13 16:34:31 +0200 |
commit | 194dbb4a501f2912ac9f46e7e2cfc6e99e3c7246 (patch) | |
tree | 60c00f07682827ca12d6423556e57de567674fdb /js | |
parent | e9dc2c3cfffd883fb7a6069b37577c770094f04e (diff) | |
download | io-slides-remote-194dbb4a501f2912ac9f46e7e2cfc6e99e3c7246.tar.gz |
Load GA tracker with requirejs
Diffstat (limited to 'js')
-rw-r--r-- | js/slide-deck.js | 19 | ||||
-rw-r--r-- | js/slides.js | 6 |
2 files changed, 8 insertions, 17 deletions
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) { | |||
808 | * @private | 808 | * @private |
809 | */ | 809 | */ |
810 | SlideDeck.prototype.loadAnalytics_ = function() { | 810 | SlideDeck.prototype.loadAnalytics_ = function() { |
811 | var _gaq = window['_gaq'] || []; | 811 | window._gaq = window['_gaq'] || []; |
812 | _gaq.push([ '_setAccount', this.config_.settings.analytics ]); | 812 | window._gaq.push([ '_setAccount', this.config_.settings.analytics ]); |
813 | _gaq.push([ '_trackPageview' ]); | 813 | window._gaq.push([ '_trackPageview' ]); |
814 | 814 | ||
815 | (function() { | 815 | requirejs([ 'analytics' ]); |
816 | var ga = document.createElement('script'); | ||
817 | ga.type = 'text/javascript'; | ||
818 | ga.async = true; | ||
819 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' | ||
820 | : 'http://www') | ||
821 | + '.google-analytics.com/ga.js'; | ||
822 | var s = document.getElementsByTagName('script')[0]; | ||
823 | s.parentNode.insertBefore(ga, s); | ||
824 | })(); | ||
825 | }; | 816 | }; |
826 | 817 | ||
827 | // Polyfill missing APIs (if we need to), then create the slide deck. | 818 | // 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({ | |||
7 | 'modernizr' : 'modernizr.custom.56571', | 7 | 'modernizr' : 'modernizr.custom.56571', |
8 | 'prettify' : 'prettify/prettify', | 8 | 'prettify' : 'prettify/prettify', |
9 | 'hammer' : 'hammer.min', | 9 | 'hammer' : 'hammer.min', |
10 | |||
11 | 'analytics' : 'https://www.google-analytics.com/ga' | ||
10 | }, | 12 | }, |
11 | 13 | ||
12 | shim : { | 14 | shim : { |
@@ -16,6 +18,4 @@ require.config({ | |||
16 | } | 18 | } |
17 | }); | 19 | }); |
18 | 20 | ||
19 | require(['slide-deck'], function(someModule) { | 21 | require(['slide-deck']); |
20 | |||
21 | }); | ||