dobarkod / cookie-banner

JavaScript based cookie-info banner for complying with EU cookie law
MIT License
425 stars 85 forks source link

banner disappears on page reload #34

Closed vrghost242 closed 7 years ago

vrghost242 commented 8 years ago

Love this solution, simple, straight forward and seems to work well.

However, I found what I think is a bug. If you load the page it comes up perfectly, but if I then do a refresh on the page, the banner does not load, not certain if from a regulatory point of view this would meet the requirements. I changed the code to set the "true" option for wait as below, but still same behaviour: new CookiesEuBanner(function(){ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    // Don't forget to put your own UA-XXXXXXXX-X code
    ga('create', '<%= trackingID %>', 'auto');
    ga('require', 'linkid', 'linkid.js');
    ga('send', 'pageview');
}), true;

Of course, if it is that regulations wise, its ok that it disappears after refresh I am happy to keep it the way it currently is.

zytzagoo commented 8 years ago

Not really sure about that GA code that you pasted above (by mistake probably)... It's got nothing to do with cookie-banner?

Can you download the zip, extract it and run the demo? (just open it in your browser locally, basic tests/demo should work that way too...)

I'm not able to reproduce the issue you described above -- eg., every reload of demo.html shows the cookie banner even if you dismiss it by clicking "nooo!1" (since the cookie setting doesn't work locally, that's expected behavior)