Refaktoryzacja skryptu zgody na pliki cookie, w tym dodanie obsługi regionów UE oraz optymalizacja logiki aktualizacji zgody
This commit is contained in:
@@ -1,32 +1,38 @@
|
|||||||
|
|
||||||
<script type="text/javascript" src="/libraries/jquery/jquery-2.1.3.min.js"></script>
|
<script type="text/javascript" src="/libraries/jquery/jquery-2.1.3.min.js"></script>
|
||||||
<script src="/libraries/CookieNoticePro/cookienoticepro.script.js"></script>
|
<script src="/libraries/CookieNoticePro/cookienoticepro.script.js"></script>
|
||||||
<link rel="stylesheet" href="/libraries/CookieNoticePro/cookienoticepro.style.css">
|
<link rel="stylesheet" href="/libraries/CookieNoticePro/cookienoticepro.style.css">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag(){dataLayer.push(arguments);}
|
|
||||||
gtag( 'consent', 'default', {
|
|
||||||
'ad_storage': 'denied',
|
|
||||||
'ad_user_data': 'denied',
|
|
||||||
'ad_personalization': 'denied',
|
|
||||||
'analytics_storage': 'denied',
|
|
||||||
'personalization_storage': 'granted',
|
|
||||||
'security_storage': 'granted',
|
|
||||||
'functionality_storage': 'granted',
|
|
||||||
} );
|
|
||||||
|
|
||||||
$( document ).ready(function() {
|
function gtag() {
|
||||||
|
dataLayer.push(arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
const gtmDefaultEuConsent = {
|
||||||
|
"ad_storage": "denied",
|
||||||
|
"ad_user_data": "denied",
|
||||||
|
"ad_personalization": "denied",
|
||||||
|
"analytics_storage": "denied",
|
||||||
|
"personalization_storage": "denied",
|
||||||
|
"functionality_storage": "denied",
|
||||||
|
"security_storage": "denied",
|
||||||
|
"wait_for_update": 2000,
|
||||||
|
"region": ["AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SI", "ES", "SE", "GB"]
|
||||||
|
};
|
||||||
|
gtag("consent", "default", gtmDefaultEuConsent);
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
cookieNoticePro.init();
|
cookieNoticePro.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
var injectScripts = function injectScripts(){
|
var injectScripts = function injectScripts() {
|
||||||
// Example: Google Analytics
|
// Example: Google Analytics
|
||||||
if (cookieNoticePro.isPreferenceAccepted("analytics") === true) {
|
if (cookieNoticePro.isPreferenceAccepted("analytics") === true) {
|
||||||
console.log("Analytics Scripts Running....");
|
//console.log("Analytics Scripts Running....");
|
||||||
}
|
}
|
||||||
// Example: Google Adwords cookie, DoubleClick, Remarketing pixels, Social Media cookies
|
// Example: Google Adwords cookie, DoubleClick, Remarketing pixels, Social Media cookies
|
||||||
if (cookieNoticePro.isPreferenceAccepted("marketing") === true) {
|
if (cookieNoticePro.isPreferenceAccepted("marketing") === true) {
|
||||||
gtag( 'consent', 'update', {
|
gtag('consent', 'update', {
|
||||||
'ad_storage': 'granted',
|
'ad_storage': 'granted',
|
||||||
'ad_user_data': 'granted',
|
'ad_user_data': 'granted',
|
||||||
'ad_personalization': 'granted',
|
'ad_personalization': 'granted',
|
||||||
@@ -34,12 +40,13 @@
|
|||||||
'personalization_storage': 'granted',
|
'personalization_storage': 'granted',
|
||||||
'security_storage': 'granted',
|
'security_storage': 'granted',
|
||||||
'functionality_storage': 'granted',
|
'functionality_storage': 'granted',
|
||||||
} );
|
"wait_for_update": 2000
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Example: Remember password, language, etc
|
// Example: Remember password, language, etc
|
||||||
if (cookieNoticePro.isPreferenceAccepted("preferences") === true) {
|
if (cookieNoticePro.isPreferenceAccepted("preferences") === true) {
|
||||||
console.log("Preferences Scripts Running....");
|
//console.log("Preferences Scripts Running....");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
Reference in New Issue
Block a user