From 0ffa8e289da2a5e520232eaf2ca58c1914bbcf33 Mon Sep 17 00:00:00 2001 From: Diana Boiangiu Date: Tue, 15 May 2018 16:04:42 +0300 Subject: [PATCH] [refs #5080] Use google analytics only on user's confirmation --- ecolex/static/css/bootstrap.custom.css | 14 ++++ ecolex/templates/bits/ga.html | 92 +++++++++++++------------- ecolex/templates/layout.html | 68 +++++++++++-------- 3 files changed, 102 insertions(+), 72 deletions(-) diff --git a/ecolex/static/css/bootstrap.custom.css b/ecolex/static/css/bootstrap.custom.css index 774299a2..00d59482 100644 --- a/ecolex/static/css/bootstrap.custom.css +++ b/ecolex/static/css/bootstrap.custom.css @@ -6960,6 +6960,20 @@ ul.select2-selection__rendered { .comment { margin-bottom: 0; } + +.analytics-cookie { + position: fixed; + top: 25%; + left: 40% !important; + max-width:400px; + display: block; +} + +.analytics-cookie-btn { + + margin-right: 5px; +} + .summary + .summary, .summary + .abstract, .summary + .comment, diff --git a/ecolex/templates/bits/ga.html b/ecolex/templates/bits/ga.html index 0b5bd3b3..2f17d9aa 100644 --- a/ecolex/templates/bits/ga.html +++ b/ecolex/templates/bits/ga.html @@ -1,56 +1,58 @@ {% if settings.GA_ENABLED %} {% endif %} diff --git a/ecolex/templates/layout.html b/ecolex/templates/layout.html index a9eaa4e2..093637f5 100644 --- a/ecolex/templates/layout.html +++ b/ecolex/templates/layout.html @@ -263,34 +263,48 @@ + - - - + if($.cookie('analyticsState') == null) { + var setCookie = function (event) { + if(event.data.okay == true){ + $.cookie('analyticsState', 'true'); } + else{ + $.cookie('analyticsState', 'false'); + } + }; + + var cookieDisclaimer = $("body").prepend( + ''); + var okButton = $('OK'); + var cancelButton = $('Cancel'); + cancelButton.click({okay: false}, setCookie); + okButton.click({okay: true}, setCookie); + $('#analytics-state').append(cancelButton); + $('#analytics-state').append(okButton); + } +}()) + + + + {% include 'bits/ga.html' %} {% include 'tour.html' %} {% block endscripts %}