correct google analytics with cookiecutr interaction
authorymh <ymh.work@gmail.com>
Tue, 27 Oct 2015 14:36:15 +0100
changeset 668 f66c544255e1
parent 667 d90c915bb1bd
child 669 0d9b16a45733
correct google analytics with cookiecutr interaction
src/hdalab/templates/base.html
src/hdalab/templates/google_analytics/analytics_template.html
src/hdalab/templates/google_analytics/async_analytics_template.html
--- a/src/hdalab/templates/base.html	Tue Oct 27 13:03:54 2015 +0100
+++ b/src/hdalab/templates/base.html	Tue Oct 27 14:36:15 2015 +0100
@@ -29,7 +29,7 @@
     <body>
 {% block header %}
         <header id="header">
-            
+
             <div class="top">
                 <div id="logo">
                     <div class="row">
@@ -125,10 +125,10 @@
             cookieMessage: '{% trans 'We use cookies on this website, you can <a href="{{cookiePolicyLink}}" title="read about our cookies">read about them here</a>. To use the website as intended please...'%}',
             cookieAcceptButtonText: "{% trans 'ACCEPT COOKIES' %}",
             cookieDeclineButtonText: "{% trans 'DECLINE COOKIES' %}",
-            cookieNotificationLocationBottom: false, // top or bottom - they are your only options, so true for bottom, false for top            
+            cookieNotificationLocationBottom: false, // top or bottom - they are your only options, so true for bottom, false for top
         });
     });
     </script>
-{% analytics %}
+{% analytics 'sync' %}
     </body>
 </html>
--- a/src/hdalab/templates/google_analytics/analytics_template.html	Tue Oct 27 13:03:54 2015 +0100
+++ b/src/hdalab/templates/google_analytics/analytics_template.html	Tue Oct 27 14:36:15 2015 +0100
@@ -1,5 +1,5 @@
 <script>
-if( $.cookieAccepted() ) { 
+if( $.cookie('cc_cookie_accept') == "cc_cookie_accept" ) { 
   (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
   (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
   m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
@@ -8,4 +8,4 @@
   ga('create', '{{ analytics_code }}', 'auto');
   ga('send', 'pageview');
 }
-</script>
\ No newline at end of file
+</script>
--- a/src/hdalab/templates/google_analytics/async_analytics_template.html	Tue Oct 27 13:03:54 2015 +0100
+++ b/src/hdalab/templates/google_analytics/async_analytics_template.html	Tue Oct 27 14:36:15 2015 +0100
@@ -1,6 +1,8 @@
 <script>
-var _gaq=[['_setAccount','{{ analytics_code }}'],['_trackPageview']];
-(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
-g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
-s.parentNode.insertBefore(g,s)}(document,'script'));
-</script>
\ No newline at end of file
+if( $.cookie('cc_cookie_accept') == "cc_cookie_accept" ) { 
+  var _gaq=[['_setAccount','{{ analytics_code }}'],['_trackPageview']];
+  (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
+  g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
+  s.parentNode.insertBefore(g,s)}(document,'script'));
+}
+</script>