Gestione della nuova cookie policy completata

This commit is contained in:
Giacomo G
2022-02-14 09:58:05 +01:00
parent 29bfd05cea
commit b37be9f3b9
2 changed files with 8 additions and 21 deletions
+7 -13
View File
@@ -211,23 +211,17 @@ const cookieBlockHtml_Bs4 = `
</div>`;
// Terze Parti Html Block
const cookieAnalyticsGTagBlock = `
<script class="gtag_block" async src="https://www.googletagmanager.com/gtag/js?id=UA-15275419-1"></script>
<script class="gtag_block">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-15275419-1');
</script>`;
const cookieAnalyticsGTagBlock = ``;
// Funzioni per la gestione dei cookie
function createCookie(name, value, days) {
const expires = () => {
if(!days) return "";
let expires = "";
if (days) {
const date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
return "; expires=" + date.toGMTString();
};
expires = "; expires=" + date.toGMTString();
}
document.cookie = name + "=" + value + expires + "; path=/";
}
@@ -251,7 +245,7 @@ function removeCookieTerzeParti() {
}
function addCookieTerzeParti() {
$(document.head).append(cookieAnalyticsGTagBlock);
if(cookieAnalyticsGTagBlock) $(document.head).append(cookieAnalyticsGTagBlock);
}
function closeBanner(slide = true) {