summaryrefslogtreecommitdiff
path: root/site/js/google-analytics-message.js
diff options
context:
space:
mode:
Diffstat (limited to 'site/js/google-analytics-message.js')
-rw-r--r--site/js/google-analytics-message.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/site/js/google-analytics-message.js b/site/js/google-analytics-message.js
index d5ecb91..5c3e1fa 100644
--- a/site/js/google-analytics-message.js
+++ b/site/js/google-analytics-message.js
@@ -28,8 +28,8 @@ if (isGoogleAnalyticsAllowedValueExist) {
// display a message with a question
toggleGoogleAnalyticsMessage('show')
- const googleAnalyticsMessageAccept = document.getElementById('google-analytics-message-accept')
- const googleAnalyticsMessageDecline = document.getElementById('google-analytics-message-decline')
+ const googleAnalyticsMessageAccept = document.querySelector('#google-analytics-accept')
+ const googleAnalyticsMessageDecline = document.querySelectorAll('#google-analytics-decline')
// register a click on the "Accept" button
googleAnalyticsMessageAccept.addEventListener('click', function () {
@@ -38,9 +38,11 @@ if (isGoogleAnalyticsAllowedValueExist) {
})
// register a click on the "Decline" button
- googleAnalyticsMessageDecline.addEventListener('click', function () {
- document.cookie = 'isGoogleAnalyticsAllowed=no'
- toggleGoogleAnalyticsMessage('hide')
+ googleAnalyticsMessageDecline.forEach(el => {
+ el.addEventListener('click', function () {
+ document.cookie = 'isGoogleAnalyticsAllowed=no'
+ toggleGoogleAnalyticsMessage('hide')
+ })
})
} \ No newline at end of file