Page reload after prior consent implemented.
After implementing prior consent on my site, I noticed it caused page to load twice. This is very undesirable. Am I implementing it incorrectly? Is there a way to avoid this reloading?
Thank you!
-
Hi BB,
This page reloading behavior after implementing cookiebot prior consent could be caused by several things, e.g. different scripts conflicts, plugins, etc. As I could not be sure what the exact problem is, could you send me your domain so I could check out what the issue is and help you solve the problem afterwards instead of guessing.
If you want you could post the domain here or sent it at s.velinov@vconnect.dk
Regards,
Spas -
Hi BB,
As we discussed the issue via email communication we came up with the solution which will be described further down.
This page double loading is actually not a page reload - it is a screen flicker that happens when consent is submitted or loaded. It is caused by one of the scripts that are loaded after consent - see the list in the scripts on the screenshot bellow.
The problem came up from the js-file “j.php” from "dev.visualwebsiteoptimizer.com" that is causing the double loading/flickering.
If you removes prior consent from this tag (line 10-16 in the page source), the flicker stops:<script type="text/plain" data-cookieconsent="preferences">var _vwo_code=(function(){
var account_id=000000,
settings_tolerance=2000,
library_tolerance=2500,
use_existing_jquery=false,
/* DO NOT EDIT BELOW THIS LINE */
f=false,d=document;return{use_existing_jquery:function(){return use_existing_jquery;},library_tolerance:function(){return library_tolerance;},finish:function(){if(!f){f=true;var a=d.getElementById('_vis_opt_path_hides');if(a)a.parentNode.removeChild(a);}},finished:function(){return f;},load:function(a){var b=d.createElement('script');b.src=a;b.type='text/javascript';b.innerText;b.onerror=function(){_vwo_code.finish();};d.getElementsByTagName('head')[0].appendChild(b);},init:function(){settings_timer=setTimeout('_vwo_code.finish()',settings_tolerance);var a=d.createElement('style'),b='body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}',h=d.getElementsByTagName('head')[0];a.setAttribute('id','_vis_opt_path_hides');a.setAttribute('type','text/css');if(a.styleSheet)a.styleSheet.cssText=b;else a.appendChild(d.createTextNode(b));h.appendChild(a);this.load('//dev.visualwebsiteoptimizer.com/j.php?a='+account_id+'&u='+encodeURIComponent(d.URL)+'&r='+Math.random());return settings_timer;}};}());_vwo_settings_timer=_vwo_code.init();</script>
When looking at this code I can see that it sets the whole body to be invisible (opacity:0), which is causing the flickering. So my advice is to keep the prior consent active on the tag and replace this part of the code:
b='body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}'
with this:
b='body{}' (edited)
Regards,
Spas
Please sign in to leave a comment.
Comments
3 comments