42 lines
1.4 KiB
Twig
42 lines
1.4 KiB
Twig
<script>
|
|
window.wpj = window.wpj || {};
|
|
wpj.jsShop = wpj.jsShop || {events:[]};
|
|
window.wpj.graphqlRoute = '{{ path('graphqliteRoute') }}';
|
|
|
|
window.dataLayer = window.dataLayer || [];
|
|
|
|
window.wpj.cookie_bar_send = {% if dbcfg.cookie_bar.send ?? 'N' == "Y" %}true{% else %}false{% endif %};
|
|
wpj.getCookie = (sKey) => decodeURIComponent(
|
|
document.cookie.replace(
|
|
new RegExp(
|
|
'(?:(?:^|.*;)\\s*' +
|
|
encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, '\\$&') +
|
|
'\\s*\\=\\s*([^;]*).*$)|^.*$'
|
|
),
|
|
'$1'
|
|
)
|
|
) || null;
|
|
|
|
|
|
{% if dbcfg.cookie_bar.send ?? 'N' == "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',
|
|
};
|
|
|
|
dataLayer.push({
|
|
'event': 'consent_default',
|
|
'consents' : consents_fields
|
|
});
|
|
{% endif %}
|
|
</script>
|