Skip to content

Commit

Permalink
Avoid logging user journey if cookie consent does not include statist…
Browse files Browse the repository at this point in the history
…ics.

Supplements #197.
  • Loading branch information
stefano-ottolenghi committed Nov 21, 2023
1 parent dc7ac3c commit 0a36ff8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/js/11-feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const URL = 'https://uglfznxroe.execute-api.us-east-1.amazonaws.com/dev/Feedback
'use strict'

const updateUserJourney = function () {
var cookieConsent = getCookie('CookieConsent')
if (cookieConsent == null || cookieConsent.indexOf('statistics:true') === -1) return

var journey = JSON.parse(localStorage.getItem('userJourney'))
if (journey == null) journey = []
journey.push({
Expand Down Expand Up @@ -58,7 +61,7 @@ const URL = 'https://uglfznxroe.execute-api.us-east-1.amazonaws.com/dev/Feedback
}

var userJourney = localStorage.getItem('userJourney')
if (JSON.parse(userJourney).length > 1) {
if (userJourney != null && JSON.parse(userJourney).length > 1) {
body += '&userJourney=' + encodeURIComponent(userJourney)
}

Expand Down

0 comments on commit 0a36ff8

Please sign in to comment.