|
<script src='https://cdn.jsdelivr.net/gh/orestbida/[email protected]/dist/cookieconsent.js'></script> |
|
<script> |
|
var cookieconsent = initCookieConsent(); |
|
cookieconsent.run({ |
|
current_lang : 'en', |
|
page_scripts: true, |
|
|
|
autorun : true, |
|
delay : 0, |
|
autoclear_cookies : true, |
|
|
|
theme_css : 'https://cdn.jsdelivr.net/gh/orestbida/[email protected]/dist/cookieconsent.css', |
|
|
|
gui_options: { |
|
consent_modal : { |
|
layout : 'cloud', // box/cloud/bar |
|
position : 'bottom center', // bottom/top + left/right/center |
|
transition: 'slide' // zoom/slide |
|
}, |
|
settings_modal : { |
|
layout : 'box', // box/bar |
|
transition: 'slide', // zoom/slide |
|
} |
|
}, |
|
|
|
onAccept: function(cookies){ |
|
if(cookieconsent.allowedCategory('necessary')){ |
|
var dataLayer = window.dataLayer || []; |
|
dataLayer.push({ |
|
event:"CookieConsent", |
|
consentType:"necessary" |
|
}); |
|
} |
|
|
|
|
|
if(cookieconsent.allowedCategory('tracking')){ |
|
var dataLayer = window.dataLayer || []; |
|
dataLayer.push({ |
|
event:"CookieConsent", |
|
consentType:"tracking" |
|
}); |
|
} |
|
|
|
if(cookieconsent.allowedCategory('performance')){ |
|
var dataLayer = window.dataLayer || []; |
|
dataLayer.push({ |
|
event:"CookieConsent", |
|
consentType:"performance" |
|
}); |
|
} |
|
|
|
|
|
}, |
|
|
|
languages : { |
|
'en' : { |
|
consent_modal : { |
|
title : "Cookies information", |
|
description : 'By clicking on "Accept all cookies", you agree to storage cookies on your device, which helps with site navigation, data usage analysis and our marketing efforts.', |
|
primary_btn: { |
|
text: 'Accept All Cookies', |
|
role: 'accept_all' //'accept_selected' or 'accept_all' |
|
}, |
|
secondary_btn: { |
|
text : 'Cookies Prefences', |
|
role : 'settings' //'settings' or 'accept_necessary' |
|
} |
|
}, |
|
settings_modal : { |
|
title : 'Cookies settings', |
|
save_settings_btn : "Save preferences", |
|
accept_all_btn : "Accept All", |
|
close_btn_label: "Close", |
|
cookie_table_headers : [ |
|
{col1: "Cookie" }, |
|
{col2: "Description" }, |
|
|
|
|
|
], |
|
blocks : [ |
|
{ |
|
title : "We use Cookies", |
|
description: 'We use cookies for analysis of our visitor data, to improve our website, show personalized content and to give you a great website experience. By using this website, you consent to this use.', |
|
},{ |
|
title : "Functional Cookies", |
|
description: 'These cookies are necessary for the Website to work, so it is not possible to disable them. They are usually set up in response to an action you take on the Website yourself, such as security settings, logging in, and filling out forms. You can set your browser to block cookies or send notifications about them. Keep in mind that some pages will not work without these files. These cookies do not store any information that can be assigned to a specific person. These cookies may be set by us or by third party providers whose services we use on the website. These cookies do not store any information that can be assigned to a specific person.', |
|
toggle : { |
|
value : 'necessary', |
|
enabled : true, |
|
readonly: true |
|
}, |
|
cookie_table: [ |
|
{ |
|
col1: 'cc_cookie', |
|
col2: 'Your Cookies Preferences from this dialog.' |
|
} |
|
] |
|
},{ |
|
title : "Analytics Cookies", |
|
description: 'These cookies are used to improve the functioning of the Website. They allow us to recognize and track the number of visitors and track how visitors use the Website. They help us improve the way the Website works, for example, by allowing users to easily find what they are looking for. These cookies do not collect information that could identify you. Using these tools, we analyze and regularly improve the functionality of our Website. We can use the obtained statistics to improve user comfort and to make your visit to the Website more interesting for you as a user.', |
|
toggle : { |
|
value : 'performance', |
|
enabled : true, |
|
readonly: false |
|
}, |
|
cookie_table: [ |
|
{ |
|
col1: '_ga/_ga*, _gid', |
|
col2: 'Google Analytics - store and count pageviews.', |
|
}, |
|
{ |
|
col1: '_gcl_au', |
|
col2: 'Google Tag Manager - Conversion linker funcionality', |
|
} |
|
] |
|
},{ |
|
title : "Marketing cookies", |
|
description: 'They are used to monitor a user\'s website preferences for the purpose of targeting advertising, ie displaying marketing and advertising messages (even on third-party sites) that may be of interest to the website visitor, in accordance with these preferences. Marketing cookies use the tools of external companies. These marketing cookies will be used only with your consent.', |
|
toggle : { |
|
value : 'tracking', |
|
enabled : false, |
|
readonly: false |
|
}, |
|
cookie_table: [ |
|
{ |
|
col1: '_fbp', |
|
col2: 'Facebook Pixel - display advertisements when either on Facebook or on a digital platform powered by Facebook advertising, after visiting the website.', |
|
}, |
|
] |
|
} |
|
] |
|
} |
|
} |
|
} |
|
}); |
|
|
|
if(!cookieconsent.validCookie('cc_cookie')){ |
|
var dataLayer = window.dataLayer || []; |
|
dataLayer.push({ |
|
event:"CookieConsent", |
|
consentType:"empty" |
|
}); |
|
|
|
|
|
} |
|
</script> |
Ahoj, omlouvám se za amatérský dotaz, chtěl jsem na web nainstalovat Cookie Consent pomocí GTM, chi pouze povolovat GA Universal a mít na webu jen kód GTM - vlastně se s GTM seznamuju.
Vložil jsem vzorový kód jako vlastní HTML značku, spouštěcí pravidlo Consent Initialization - All Pages.
Další značku ze šablony Google Analytics Universal Analytic spouštěcí pravidlo All Pages.
Cookie consent se objeví, cookie cc_cookie se vytvoří, když vše povolím má hodnoty {"level":["necessary","performance","tracking"],"revision":0,"data":null,"rfc_cookie":false}
Když nepovolím nic je hodnota jen
{"level":["necessary"],"revision":0,"data":null,"rfc_cookie":false}
takže tohle funguje
Cookie pro Google Analytic se ale vytvoří vždy ať mám povoleno nebo zakázáno.
Zkoušel jsem ještě šablonu Cookiebot a ta funguje správně, GA povoluje / zakazuje
U Cookie Consent GTM.js ale nedokážu nastavit aby se GA nespouštělo a cookie mazalo ( autoclear_cookies : true mám jak je ve skriptu ale to nic nedělá )
Pročítal jsem různé články jak GTM nastavit, už mám verzi pracovního prostoru 47 ale pořád to nejede.
Poradíte mi prosím jaké kroky udělat - postup, jak to celé nastavit, aby se GA spouštělo jak má a cookie se v ideálním případě mazaly.
moc děkuji za rady
Vašek