A lightweight, skinnable jQuery plug-in created to handle the newly introduced EU Cookie Legislation
1. Choose a skin
You can choose an existing jQuery UI* theme from below, or
roll your own and link to your CSS file in the same way
2. Create your consent levels
The cookie consent plug-in comes with four default levels for the user to choose from (the same as the demo on this page).
If you'd prefer to create your own, however, you can fill in the boxes below.
3. Supply an 'edit settings' element
Your users will need a way to change their settings.
Supply an element here which when clicked will display the options you've defined above.
4. A link to your Cookie policy page
By law you must have a page on your site explaining how cookies are used on your site and how you manage personal data.
If this property is not supplied here, you should have a link elsewhere on your website.
The essentials…
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript" src="http://cookieconsent.com/releases/latest/cookie-consent.js"></script> <script type="text/javascript"> $(function(){ var cookieconsent = $.cookieconsent({ default_level_id: '', edit_settings_element: , jqueryui_theme_css: '', levels:[ ] }); }); </script>Instructions: Copy the above code into your page after your link to jQuery.
But wait!
What about 3rd party scripts?
Some 3rd party scripts will need a slight tweak so that they don't get run when they're not supposed to.
For any level dependant <script type="text/javascript"> tag you'll need to:- change it's type to text/plain instead of text/javascript
- add a cookieconsent-level attribute to it, who's value is the id of the level it's dependant on
Let's say you've got a level with id 'tracking' and you had a script that should run only when the tracking level is enabled.
Instead of having<script type="text/javascript">... you would change it to ...
<script type="text/plain" cookieconsent-level="tracking">