var idCookie = 'aaaaaaa-cookie'; var hideDelay = 0; var validDays = 90; var domCookie = document.querySelector('.cookie-wrapper'); var domCookieAccept = document.querySelector('.cookie-accept'); var GA_ID = "UA-114842907-1"; var GT_ID = "GTM-P769CRQ"; var now = new Date(); function getExpirationDate() { var result = new Date(now); result.setDate(result.getDate() + validDays); return result;} var expirationDate = getExpirationDate(); var head = document.getElementsByTagName('head')[0]; function loadGA() { var script = document.createElement('script'); script.type = 'text/javascript'; script.src = 'https://www.googletagmanager.com/gtag/js?id=' + GA_ID; head.appendChild(script); script = document.createElement('script'); script.type = 'text/javascript'; script.textContent = "window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '" + GA_ID + "' );"; head.appendChild(script);} function loadGT() { (function(w, d, s, l, i) {w[l] = w[l] || [];w[l].push({'gtm.start': new Date().getTime(),event: 'gtm.js'}); var f = d.getElementsByTagName(s)[0],j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true;j.src ='https://www.googletagmanager.com/gtm.js?id=' + i + dl;f.parentNode.insertBefore(j, f); })(window, document, 'script', 'dataLayer', GT_ID);} function cookieAccepted() { if (domCookie) { setTimeout(function() { domCookie.style.display = 'none' }, hideDelay) } typeof GA_ID !== "undefined" && loadGA(); typeof GT_ID !== "undefined" && loadGT(); } function checkCookieAccept() { var result = localStorage.getItem(idCookie) var expDate = new Date(result) if (!result) { if (domCookie) { domCookie.style.display = 'block' } } else { if(expDate - now > 0) { cookieAccepted() } else { localStorage.removeItem(idCookie) } } } function acceptCookie() { let result = localStorage.getItem(idCookie) if (!result) { localStorage.setItem(idCookie, expirationDate) cookieAccepted(); } } checkCookieAccept() if (domCookieAccept) { domCookieAccept.addEventListener('click', acceptCookie) }