Skip to content

Commit

Permalink
Add cookie consent check to global bar init
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanita Barrett committed Feb 4, 2020
1 parent fc0cd56 commit 15d4206
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/assets/javascripts/global-bar-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@ var globalBarInit = {
},

setBannerCookie: function() {
var cookieCategory = window.GOVUK.getCookieCategory("global_bar_seen")
var cookieConsent = GOVUK.getConsentCookie()

if (cookieConsent && cookieConsent[cookieCategory]) {
var value = JSON.stringify({count: 0, version: globalBarInit.getBannerVersion()})

window.GOVUK.setCookie("global_bar_seen", value, {days: 84});
}
},

makeBannerVisible: function() {
Expand Down

0 comments on commit 15d4206

Please sign in to comment.