Streaming live at 10am (PST)

Popup cookie not working

I am using the following code to stop my GDPR popup not reappearing after the user clicks accept.

Any ideas why the popup reappears on refresh/navigating to another page.

I placed it in site-wide custom code, and wrapped in script tags.

var popup = document.getElementById(‘consentPopup’);
var alreadyLoaded = window.localStorage.getItem(‘fbGrantConsent’) === ‘true’;

//Show the consent banner if consent is not granted, hide it if consent is already granted.
if (alreadyLoaded) { = ‘none’;
} else { = ‘flex’;

//Grant consent and store it in localStorage of the browser
var consentBtn = document.getElementById(‘consentBtn’);
consentBtn.addEventListener(“click”, function() {
fbq(‘consent’, ‘grant’);
window.localStorage.setItem(‘fbGrantConsent’, ‘true’);

1 Like

Anyone with a tip on this?