Chome end of third-party cookies #634
-
Starting on January 4th 2024 chome will start blocking third-party cookies for 1% of users and for the Q3 2024 will be the 100% My principal concert is how will this affect my sites using Google Analytics or Google Tag Manager? gtag('consent', 'default', { 'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied' }); And when the user accepts de banner i updated to: <script type="text/plain" data-category="analytics">
gtag('consent', 'update', { 'ad_storage': 'granted' });
</script> Is this correct? and how will be applied on other third-party cookies that don't use Consent Mode V2? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
@adriallongarriu, we're talking about third party cookies. We don't interact directly with third party cookies, those are set from external services and removed when the browser session ends. I assume nothing will change for us, since this plugin only handles first party cookies. This is how I would implement google consent mode v2 using script tags: <script
type="text/plain"
data-category="necessary">
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',
functionality_storage: 'denied',
personalization_storage: 'denied',
wait_for_update: 500
});
gtag('set', 'ads_data_redaction', true);
gtag('set', 'url_passthrough', true);
</script>
<script
type="text/plain"
data-category="analytics"
data-service="Google Analytics 4">
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
gtag('consent', 'update', {
personalization_storage: 'granted',
functionality_storage: 'granted',
analytics_storage: 'granted'
});
console.log("gtag: analytics_storage=granted");
</script>
<!-- Stop sending events to google analytics on opt-out -->
<script
type="text/plain"
data-category="analytics"
data-service="!Google Analytics 4">
window['ga-disable-G-XXXXXXXXXX'] = true;
CookieConsent.eraseCookies(/^(_ga|gid|__utm)/);
console.log("gtag: disable tracking");
</script>
<script
type="text/plain"
data-category="ads"
data-service="Google Ads">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'update', {
ad_storage: 'granted'
});
console.log("gtag: ad_storage=granted");
</script>
<script
type="text/plain"
data-category="analytics"
data-service="Google Analytics 4"
async
data-src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX">
</script> |
Beta Was this translation helpful? Give feedback.
-
Right now, I´m mostly doing it this way: <script>
let flags = 'max-age=7200;secure;samesite=none';
if (document.location.protocol !== 'https:') { flags = 'max-age=7200;samesite=none';}
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('consent', 'default', {
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'ad_storage': 'denied',
'analytics_storage': 'denied',
'wait_for_update': 500
});
/*gtag('set', 'url_passthrough', true);
gtag("set", "ads_data_redaction", true);*/
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX', {cookie_flags: flags});
gtag('config', 'AW-XXXXXXXXXX', {cookie_flags: flags});
</script>
<script type="text/plain" data-category="analytics">
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('consent', 'update', {'analytics_storage': 'granted'});
</script>
<script type="text/plain" data-category="!analytics">
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('consent', 'update', {'analytics_storage': 'denied'});
window['ga-disable-G-XXXXXXXXXX'] = true;
CookieConsent.eraseCookies(/^(_ga|gid|__utm)/);
</script>
<script type="text/plain" data-category="targeting">
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('consent', 'update', {'ad_storage': 'granted', 'ad_user_data': 'granted', 'ad_personalization': 'granted'});
</script>
<script type="text/plain" data-category="!targeting">
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('consent', 'update', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied'});
CookieConsent.eraseCookies(/^(_ga|gid|__utm)/);
</script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX / AW-XXXXXXXXXX"></script> I´ve removed php code used for building this, as it´s only included if any G / AW tag is set and based on it, it decided which parts are used - not sure, if it´s right, but I´m granting ad_* parameters only when AW code for adwords is present. And I have no idea, if I have to have this in every script block: window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); } ? Also, I´m not setting defaults and last script async via CC, because after reading whole a lot of stuff on Google, I think It does get some analytics data without cookies and I should be able to get these anonymous analytics that do not use cookies without any consents. What do you think @orestbida ? |
Beta Was this translation helpful? Give feedback.
-
@orestbida |
Beta Was this translation helpful? Give feedback.
@adriallongarriu, we're talking about third party cookies. We don't interact directly with third party cookies, those are set from external services and removed when the browser session ends. I assume nothing will change for us, since this plugin only handles first party cookies.
This is how I would implement google consent mode v2 using script tags: