Skip to content

Commit 5b57737

Browse files
committed
Avoid showing more than once analitics consent
1 parent 676296e commit 5b57737

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

assets/javascripts/app/app.coffee

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
try @initErrorTracking() catch
1212
return unless @browserCheck()
1313

14+
@showAnaliticsOne = false
1415
@el = $('._app')
1516
@localStorage = new LocalStorageStore
1617
@serviceWorker = new app.ServiceWorker if app.ServiceWorker.isEnabled()
@@ -216,7 +217,7 @@
216217
onCookieBlocked: (key, value, actual) ->
217218
return if @cookieBlocked
218219
@cookieBlocked = true
219-
new app.views.Notif 'CookieBlocked', autoHide: null
220+
new app.views.Notif 'CookieBlocked', autoHide: 2000
220221
Raven.captureMessage "CookieBlocked/#{key}", level: 'warning', extra: {value, actual}
221222
return
222223

assets/javascripts/lib/page.coffee

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ page.track = (fn) ->
200200

201201
track = ->
202202
return unless app.config.env == 'production'
203+
return if app.analiticsAlreadyShown
203204

205+
app.analiticsAlreadyShown = true
204206
consentGiven = Cookies.get('analyticsConsent')
205207
consentAsked = Cookies.get('analyticsConsentAsked')
206208

@@ -210,7 +212,7 @@ track = ->
210212
# Only ask for consent once per browser session
211213
Cookies.set('analyticsConsentAsked', '1')
212214

213-
new app.views.Notif 'AnalyticsConsent', autoHide: null
215+
new app.views.Notif 'AnalyticsConsent', autoHide: 2000
214216
return
215217

216218
@resetAnalytics = ->

0 commit comments

Comments
 (0)