Replies: 3 comments 7 replies
-
Can you share your current gtm configuration? |
Beta Was this translation helpful? Give feedback.
-
Hi, right know we are using plugin only for start GTM, so we have data on script and start or not. GTM is on other person, but they want from me to configure cookies for new V2 regulation. |
Beta Was this translation helpful? Give feedback.
-
@nmdgent-jefverme Hi, so i was tried how you say and there is couple of things from my side. What do you think? <script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {
'analytics_storage': 'denied',
'functionality_storage': 'denied',
'personalization_storage': 'denied',
'security_storage': 'denied',
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
});
gtag('js', new Date());
</script>
<!-- Google Tag Manager -->
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-???????');
</script>
<!-- End Google Tag Manager --> and where put this? onConsent: () => {
sendPreferences();
},
onChange: () => {
sendPreferences();
}, and this? function sendPreferences () {
gtag('consent', 'update', {
analytics_storage: CookieConsent.acceptedCategory('analytics') ? 'granted' : 'denied',
functionality_storage: CookieConsent.acceptedCategory('necessary') ? 'granted' : 'denied',
personalization_storage: CookieConsent.acceptedCategory('marketing') ? 'granted' : 'denied',
security_storage: CookieConsent.acceptedCategory('necessary') ? 'granted' : 'denied',
ad_storage: CookieConsent.acceptedCategory('marketing') ? 'granted' : 'denied',
ad_user_data: CookieConsent.acceptedCategory('marketing') ? 'granted' : 'denied',
ad_personalization: CookieConsent.acceptedCategory('marketing') ? 'granted' : 'denied',
});
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'Cookie preferences',
cookies: CookieConsent.getUserPreferences().acceptedCategories.join(' '),
});
} I was thinking its into js file from orestbida for settings, but its looks like this dont understand what i want for him. window.addEventListener("load", function () {
var cc = initCookieConsent();
cc.run({
current_lang: "cz",
autoclear_cookies: true,
page_scripts: true,
cookie_expiration: 360,
onConsent: () => {
sendPreferences();
},
onChange: () => {
sendPreferences();
},
function sendPreferences () {
gtag('consent', 'update', {
analytics_storage: CookieConsent.acceptedCategory('analytics') ? 'granted' : 'denied',
functionality_storage: CookieConsent.acceptedCategory('necessary') ? 'granted' : 'denied',
personalization_storage: CookieConsent.acceptedCategory('marketing') ? 'granted' : 'denied',
security_storage: CookieConsent.acceptedCategory('necessary') ? 'granted' : 'denied',
ad_storage: CookieConsent.acceptedCategory('marketing') ? 'granted' : 'denied',
ad_user_data: CookieConsent.acceptedCategory('marketing') ? 'granted' : 'denied',
ad_personalization: CookieConsent.acceptedCategory('marketing') ? 'granted' : 'denied',
});
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'Cookie preferences',
cookies: CookieConsent.getUserPreferences().acceptedCategories.join(' '),
});
} |
Beta Was this translation helpful? Give feedback.
-
Until now, I have only used cookies from orestbida to insert GTM and enable or disable. Now we are struggling with the new Consent Mode V2 regulation and I don't know how to do this linking properly
Beta Was this translation helpful? Give feedback.
All reactions