sameSite Cookie Error
-
Issue I’ve ran into in the past week with the roll-out by Google, Safari and Firefox related to the pending termination of 3rd party cookies is getting errors in the browser’s developer console
Cookie “_ga” will be soon rejected because it has the “sameSite” attribute set to “none” or an invalid value, without the “secure” attribute. To know more about the “sameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite
Cookie “_gid” will be soon rejected because it has the “sameSite” attribute set to “none” or an invalid value, without the “secure” attribute. To know more about the “sameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite
I am using the latest gtag.js implementation with your plugin on several websites. The part of the plugin which outputs:
gtag('config', 'OUR_GA_ID');
note replaced my actual GA ID above, but I’ve found that if I disable the plugin and manually paste the tracker code from Google Analytics into my header.php the cookie notice goes away when you modify
gtag('config', 'OUR_GA_ID');
to be
gtag('config', 'OUR_GA_ID', {cookie_flags: 'SameSite=None;Secure'});
thus making the full tracking code be:
<!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=OUR_GA_ID"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'OUR_GA_ID', {cookie_flags: 'SameSite=None;Secure'}); </script>
Is there anyway with the plugin to inject the additional code into the tag output by the plugin?
{cookie_flags: 'SameSite=None;Secure'}
- The topic ‘sameSite Cookie Error’ is closed to new replies.