When we enable our WPML plugin across staging and production, along with Cookie Script (hidden link), we are getting an odd bug. On IE, Chrome and Edge browsers, the cookie that is trying to be set to redirect based upon language via WPML is conflicting with the cookie script and cause a continual page refresh.
The specific WPML setting in question is "Browser language redirect". If I leave it disabled, we don't have any problem. If I try to set it to either:
-Redirect visitors based on browser language only if translations exist OR
-Always redirect visitors based on browser language (redirect to home page if translations are missing)
It creates the issue? We have direct translations from US EN to UK EN for every page.
Please let me know what we're missing or what's going on as I need to get this fixed asap!
Can you please clarify how you are using cookie-script.com, and what is it you are doing that causes the issue?
I'm not familiar with it. It doesn't look like you are using a plugin from them, I'm guessing you have perhaps added some JavaScript from them and that is conflicting with the JS from WPML relating to the browser language redirect.
Yes, we have tried both the Cookie Script WP plugin, as well as the simple JS embed. Both inject the following into the page header: <script type="text/javascript" charset="UTF-8" src="//cdn.cookie-script.com/s/585b97d9c51741d1819395525c83b2e8.js"></script>
We've disabled on production as it's creating a constant page refresh in IE. It is live however on our staging environment, as well as WPML.
hidden link
I did a hard stop on the browser refresh, and there are no console errors related to it.
We are using cookie-script to manage our GTM and tracking cookies across the site, for users to opt in/out.
Thanks for that. I've visited the staging site and see the issue.
I've downloaded the script from cookie-script but it's obtuse and I can't learn anything meaningful from looking at the code.
Conceptually, I guess the cookie-script is trying to intervene to prevent anything adding cookies before consent has been given, and the WPML browser redirection script adds a language-related cookie as it redirects to the other language, triggering this never-ending cycle of redirects.
It may be that the developers of cookie-script and WPML need to work together on this, but before escalating this any further, I wonder if with cookie-script there is any option to whitelist certain cookies where it doesn't pre-emptively try to block them?
I can see when I visit your actual site which doesn't have the issue that there are a couple of cookies added when first visiting the page before interacting with the cookie banner, and even if you decline all cookies including strictly necessary cookies there are still 3 cookies added. So it seems feasible that there might be a whitelist option of some kind.
In my testing (own test site) WPML added these 2 cookies when the browser redirection was operational:
wpml_browser_redirect_test (a session cookie)
_icl_visitor_lang_js (a 24 hour cookie)
Could you check with cookie-script about the feasibility of white-listing these cookies?
The topic ‘[Closed] Cookie Script conflict’ is closed to new replies.