93 lines
3.2 KiB
Smarty
93 lines
3.2 KiB
Smarty
<script>
|
|
window.wpj = window.wpj || {ldelim}{rdelim};
|
|
wpj.onReady = wpj.onReady || [];
|
|
wpj.jsShop = wpj.jsShop || {literal}{events:[]}{/literal};
|
|
|
|
window.dataLayer = window.dataLayer || [];
|
|
function gtag() {
|
|
window.dataLayer.push(arguments);
|
|
}
|
|
window.wpj.cookie_bar_send = {if $dbcfg.cookie_bar.send == 'Y'}true{else}false{/if};
|
|
|
|
wpj.getCookie = (sKey) => decodeURIComponent(
|
|
document.cookie.replace(
|
|
new RegExp(
|
|
'(?:(?:^|.*;)\\s*' +
|
|
encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, '\\$&') +
|
|
'\\s*\\=\\s*([^;]*).*$)|^.*$'
|
|
),
|
|
'$1'
|
|
)
|
|
) || null;
|
|
|
|
{if $dbcfg.cookie_bar.send == "Y"}
|
|
var consents = wpj.getCookie('cookie-bar')?.split(',');
|
|
|
|
if (!(consents instanceof Array)){
|
|
consents = [];
|
|
}
|
|
|
|
consents_fields = {
|
|
ad_storage: consents.includes('ad_storage') ? 'granted' : 'denied',
|
|
ad_user_data: consents.includes('ad_storage') ? 'granted' : 'denied',
|
|
ad_personalization: consents.includes('ad_storage') ? 'granted' : 'denied',
|
|
personalization_storage: consents.includes('personalization_and_functionality_storage') ? 'granted' : 'denied',
|
|
functionality_storage: 'granted',
|
|
analytics_storage: consents.includes('analytics_storage') ? 'granted' : 'denied',
|
|
};
|
|
gtag('consent', 'default', consents_fields);
|
|
|
|
gtag("set", "ads_data_redaction", true);
|
|
|
|
dataLayer.push({
|
|
'event': 'defaultConsent',
|
|
'consents' : consents_fields
|
|
});
|
|
{/if}
|
|
</script>
|
|
|
|
{include 'components/js_data.tpl'}
|
|
|
|
{if $dbcfg.analytics.cookiebot.ID}
|
|
<script data-cookieconsent="ignore">
|
|
gtag("consent", "default", {
|
|
ad_storage: "denied",
|
|
ad_user_data: "denied",
|
|
ad_personalization: "denied",
|
|
analytics_storage: "denied",
|
|
functionality_storage: "granted",
|
|
personalization_storage: "denied",
|
|
security_storage: "granted",
|
|
wait_for_update: 2000,
|
|
});
|
|
gtag("set", "ads_data_redaction", true);
|
|
gtag("set", "url_passthrough", false);
|
|
</script>
|
|
|
|
<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js"
|
|
data-cbid="{$dbcfg.analytics.cookiebot.ID}" data-blockingmode="auto" type="text/javascript"></script>
|
|
{/if}
|
|
|
|
{if $dbcfg.analytics.fb_pixel.id}
|
|
<!-- Facebook Pixel Code -->
|
|
<script>
|
|
{literal}
|
|
!function(f,b,e,v,n,t,s)
|
|
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?{/literal}
|
|
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
|
|
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
|
|
n.queue=[];{if $dbcfg.cookie_bar.enable != "Y" or !empty($smarty.cookies['cookie-bar'])}
|
|
t=b.createElement(e);t.async=!0;
|
|
t.src=v;s=b.getElementsByTagName(e)[0];
|
|
s.parentNode.insertBefore(t,s){/if}}(window,document,'script',
|
|
'https://connect.facebook.net/en_US/fbevents.js');
|
|
</script>
|
|
{if $dbcfg.cookie_bar.enable != "Y" or empty($smarty.cookies['cookie-bar'])}
|
|
<noscript>
|
|
<img height="1" width="1" alt=""
|
|
src="https://www.facebook.com/tr?id={$dbcfg.analytics.fb_pixel.id}&ev=PageView&noscript=1"/>
|
|
</noscript>
|
|
{/if}
|
|
<!-- End Facebook Pixel Code -->
|
|
{/if}
|