From 93a7df295a16bfd6fe7fb46b676dee7ba468ad6d Mon Sep 17 00:00:00 2001 From: Davor Spasovski Date: Fri, 25 Jan 2013 08:36:30 -0800 Subject: [PATCH] GA parse priority adjustment (bug 826094) --- lib/settings_base.py | 5 +++-- media/js/impala/preloaded.js | 2 +- media/js/zamboni/analytics.js | 14 ++++++++++++++ media/js/zamboni/init.js | 15 --------------- templates/base.html | 1 + 5 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 media/js/zamboni/analytics.js diff --git a/lib/settings_base.py b/lib/settings_base.py index 0a3dadb432..72212aa72f 100644 --- a/lib/settings_base.py +++ b/lib/settings_base.py @@ -674,10 +674,11 @@ MINIFY_BUNDLES = { 'js/impala/site_suggestions.js', ), - # Impala: Things to be loaded at the top of the page + # Impala and Legacy: Things to be loaded at the top of the page 'preload': ( 'js/lib/jquery-1.6.4.js', - 'js/impala/preloaded.js' + 'js/impala/preloaded.js', + 'js/zamboni/analytics.js', ), # Impala: Things to be loaded at the bottom 'impala': ( diff --git a/media/js/impala/preloaded.js b/media/js/impala/preloaded.js index 68f64ce797..00347ff4e9 100644 --- a/media/js/impala/preloaded.js +++ b/media/js/impala/preloaded.js @@ -21,7 +21,7 @@ $window.bind('buttons_loaded_click', function() { $el.trigger('click'); }); - }) + }); $window.bind('buttons_loaded', function() { // Trigger all the clicks $window.trigger('buttons_loaded_click'); diff --git a/media/js/zamboni/analytics.js b/media/js/zamboni/analytics.js new file mode 100644 index 0000000000..b2955b6ee4 --- /dev/null +++ b/media/js/zamboni/analytics.js @@ -0,0 +1,14 @@ +// GA Analytics code. The '_setAccount' below is specific to AMO tracking. + +var _gaq = _gaq || []; +_gaq.push(['_setAccount', 'UA-36116321-7']); +_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); +})(); diff --git a/media/js/zamboni/init.js b/media/js/zamboni/init.js index 3715c314a1..98ccb67543 100644 --- a/media/js/zamboni/init.js +++ b/media/js/zamboni/init.js @@ -1,21 +1,6 @@ /* Global initialization script */ var z = {}; -// Google Analytics initialization. -var _gaq = _gaq || []; -_gaq.push(['_setAccount', 'UA-36116321-7']); -_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); -})(); -// End of GA initialization. - $(document).ready(function(){ // Initialize install buttons. $('.install').installButton(); diff --git a/templates/base.html b/templates/base.html index a79ce3a0c5..3dc43bac5e 100644 --- a/templates/base.html +++ b/templates/base.html @@ -37,6 +37,7 @@ {% if request.user.is_authenticated() %} {% endif %} + {{ js('preload') }}