@@ -100,6 +100,10 @@ function setupSettings(hub) {
100
100
return currentSettings ;
101
101
}
102
102
103
+ function hasCookieConsented ( options ) {
104
+ return jsCookie . get ( options . policies . cookies . key ) === options . policies . cookies . hash ;
105
+ }
106
+
103
107
function setupButtons ( options ) {
104
108
var alertSystem = new Alert ( ) ;
105
109
@@ -117,14 +121,12 @@ function setupButtons(options) {
117
121
}
118
122
} ) ;
119
123
}
120
- var hasCookieConsented = function ( ) {
121
- return jsCookie . get ( options . policies . cookies . key ) === options . policies . cookies . hash ;
122
- } ;
124
+
123
125
if ( options . policies . cookies . enabled ) {
124
126
var getCookieTitle = function ( ) {
125
127
return 'Cookies & related technologies policy<br><p>Current consent status: <span style="color:' +
126
- ( hasCookieConsented ( ) ? 'green' : 'red' ) + '">' +
127
- ( hasCookieConsented ( ) ? 'Granted' : 'Denied' ) + '</span></p>' ;
128
+ ( hasCookieConsented ( options ) ? 'green' : 'red' ) + '">' +
129
+ ( hasCookieConsented ( options ) ? 'Granted' : 'Denied' ) + '</span></p>' ;
128
130
} ;
129
131
$ ( '#cookies' ) . click ( function ( ) {
130
132
alertSystem . ask ( getCookieTitle ( ) , $ ( require ( './policies/cookies.html' ) ) , {
@@ -225,6 +227,8 @@ function initPolicies(options) {
225
227
if ( options . policies . cookies . enabled && storedCookieConsent !== '' &&
226
228
options . policies . cookies . hash !== storedCookieConsent ) {
227
229
simpleCooks . show ( ) ;
230
+ } else if ( options . policies . cookies . enabled && hasCookieConsented ( options ) ) {
231
+ analytics . initialise ( ) ;
228
232
}
229
233
}
230
234
0 commit comments