Files
__inwestprofil.pagedev.pl/wp-content/themes/hello-elementor/plugins/CookieNoticePro/cookies.php
Roman Pyrih 20ee667968 Save
2025-08-12 12:10:06 +02:00

52 lines
1.6 KiB
PHP

<?php
add_action('wp_footer', function () {
if ( function_exists('cookie_notice_pro_code') ) {
cookie_notice_pro_code();
}
}, 20);
?>
<?php function cookie_notice_pro_code() { ?>
<script type="text/javascript">
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.addEventListener( 'DOMContentLoaded', function() {
cookieNoticePro.init();
});
var injectScripts = function injectScripts(){
// Example: Google Analytics
if (cookieNoticePro.isPreferenceAccepted("analytics") === true) {
console.log("Analytics Scripts Running....");
}
// Example: Google Adwords cookie, DoubleClick, Remarketing pixels, Social Media cookies
if (cookieNoticePro.isPreferenceAccepted("marketing") === true) {
gtag( 'consent', 'update', {
'ad_storage': 'granted',
'ad_user_data': 'granted',
'ad_personalization': 'granted',
'analytics_storage': 'granted',
'personalization_storage': 'granted',
'security_storage': 'granted',
'functionality_storage': 'granted',
} );
}
// Example: Remember password, language, etc
if (cookieNoticePro.isPreferenceAccepted("preferences") === true) {
console.log("Preferences Scripts Running....");
}
}
</script>
<?php } ?>