Skip to content

Instantly share code, notes, and snippets.

@jamescridland
Created September 15, 2015 18:10
Show Gist options
  • Save jamescridland/a0783283b90550046f87 to your computer and use it in GitHub Desktop.
Save jamescridland/a0783283b90550046f87 to your computer and use it in GitHub Desktop.
The easiest EU cookie solution code ever?
<!--
Put this just under your <HEAD> in HTML.
Note - it displays once, and once only.
It requires you to run Google Analytics on your website.
If a user deletes their cookies, it'll appear again.
You can test it by going into Incognito Mode.
-->
<script type='text/javascript'>
if (document.cookie.indexOf('_ga') == -1) {
document.write("<div style='width:100%; background-color:#d5e8f3;padding:10px;'>We use cookies to personalise content and ads and to improve your browsing experience. We share limited data with our advertising and analytics partners to help us run our business better.<a href='/cookies'>Find out more about our cookies</a></div>");
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment