setConsentGiven is not setting the cookie

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.


document.addEventListener('click', function (event) {
	if (!'.agree-button')) return;
}, false);

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

if (cookieValue === "2") {

Thanks for the help.

If you provide me the URL to your site, I can try to take a look.