Quantcast
Channel: Support & Bugs - Matomo forums
Viewing all articles
Browse latest Browse all 5706

setConsentGiven is not setting the cookie

$
0
0

@Ian_Burrows wrote:

Hi, I am having an issue where the tracking cookie is not being set. It is on a Drupal site. I have the following code and cannot figure out why it is not working.

_paq.push(['requireConsent']);

document.addEventListener('click', function (event) {
	if (!event.target.matches('.agree-button')) return;
	event.preventDefault();
       _paq.push(['setConsentGiven']);
}, false);

var cookieValue = document.cookie.replace(/(?:(?:^|.*;\s*)cookie-agreed\s*\=\s*([^;]*).*$)|^.*$/, "$1");

if (cookieValue === "2") {
     _paq.push(['setConsentGiven']);
};

Thanks for the help.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5706

Trending Articles