Cookie _ga… has been rejected for invalid domain
-
Hi,
Firstly thanks for a great plugin. Unfortunately, I’m seeing some errors in Firefox (latest version 132.0.2) – vis:
Cookie _ga_MYTRACKINGID has been rejected for invalid domain
- In the browser console. For all GA (& some other) cookies. Only in Firefox and only for .co.uk domains (so far as tested).
Researching the issue it appears that Firefox is now enforcing strict SameSite/Secure policy.
I believe what is needed are a couple of extra options in your plugin’s settings (wp-admin > Analytics Insights > Tracking Code > Advanced Settings > Cookie Customization) to add extra options for:
- SameSite (None/Lax/Strict)
- IsSecure (notset/Secure)
This would then be used to construct change :
gtag('config', 'GA_MEASUREMENT_ID');
to:
gtag('config', 'GA_MEASUREMENT_ID', { cookie_flags: 'SameSite=None;Secure' });
or equivalently:
gtag('set', {cookie_flags: 'SameSite=None;Secure'});
gtag('config', 'GA_MEASUREMENT_ID');- in the header code.
There used to be a way to set these via Google Tag Manager (Variables), but it seems no longer possible.
This seems to be in increasingly frequent problem for many sites, many cookies (not only GA).
Any chance you could provide a fix such as above, or some other work-around?
Very many thanks
Rob
- You must be logged in to reply to this topic.