Jump to content

Cookie Consent used on this website


Jon
 Share

Recommended Posts

  • Administrators

I've reworked the cookie popup I need to use on this site (Google Policy rather than wanting to waste effort on the EU "law" - I had actually removed cookie popups a year ago). I was using the Cookie Consent javascript from https://silktide.com/tools/cookie-consent/ but the original was trying to be too clever for my tastes with multiple font sizes and sliders for different screen sizes. It didn't look great on my desktop, tablet, phone the font sizes were either too big or too small. It would I've stripped it down to the bare minimum to reduce distraction. It just features a single line in body text modelled on http://www.theregister.co.uk 

The original version used an Amazon S3 address for the javascript and CSS which was OK but the Cache-Control / Expires headers are not present which wasn't great for PageSpeed/YSlow reports and caching. With this version you have to self-host the files. Of course if you use a CDN you can upload them there too.

Whether it complies with the EU cookie law as implemented in your country is for you to determine - this implementation is fine for the UK at least.

To use:

- Upload the js and css files to your host somewhere. 

- Add this code to your pages just before the </head> tag. Modify the text as required and adjust the url for the css. 

Example:

<!-- Begin Cookie Consent -->
<script type="text/javascript">
    window.cookieconsent_options = {"message":"This website uses cookies","dismiss":"Close","learnMore":"Find out more","link":"https://www.yoursite.com/site/cookie-policy/","theme":"//www.yoursite.com/js/cookieconsent/cookieconsent-dark.css"};
</script>

<script type="text/javascript" src="//www.yoursite.com/js/cookieconsent/cookieconsent.min.js"></script>
<!-- End Cookie Consent -->

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...