Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid showing analitics notification more than once #1581

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion assets/javascripts/app/app.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
try @initErrorTracking() catch
return unless @browserCheck()

@showAnaliticsOne = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be analiticsAlreadyShown?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, should be fine now.

@el = $('._app')
@localStorage = new LocalStorageStore
@serviceWorker = new app.ServiceWorker if app.ServiceWorker.isEnabled()
Expand Down Expand Up @@ -216,7 +217,7 @@
onCookieBlocked: (key, value, actual) ->
return if @cookieBlocked
@cookieBlocked = true
new app.views.Notif 'CookieBlocked', autoHide: null
new app.views.Notif 'CookieBlocked', autoHide: 2000
Raven.captureMessage "CookieBlocked/#{key}", level: 'warning', extra: {value, actual}
return

Expand Down
4 changes: 3 additions & 1 deletion assets/javascripts/lib/page.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ page.track = (fn) ->

track = ->
return unless app.config.env == 'production'
return if app.analiticsAlreadyShown

app.analiticsAlreadyShown = true
consentGiven = Cookies.get('analyticsConsent')
consentAsked = Cookies.get('analyticsConsentAsked')

Expand All @@ -210,7 +212,7 @@ track = ->
# Only ask for consent once per browser session
Cookies.set('analyticsConsentAsked', '1')
Comment on lines 214 to 215
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does your change relate to those two lines? You to tackle the same problem.

Copy link
Contributor Author

@MasterEnoc MasterEnoc Jun 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line avoids show me more than once the analitics consent when cookies are enabled, In my case I do not accept neither the devdocs cookie nor the analitics, thus this line does not fix the problem.


new app.views.Notif 'AnalyticsConsent', autoHide: null
new app.views.Notif 'AnalyticsConsent', autoHide: 2000
return

@resetAnalytics = ->
Expand Down