Skip to content

Commit c9f34c0

Browse files
committed
update readme
1 parent 9c0df9d commit c9f34c0

File tree

2 files changed

+86
-4
lines changed

2 files changed

+86
-4
lines changed

README.md

+85-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,85 @@
1-
# jquery-cookiebar
2-
jQuery CookieBar Plugin
1+
# jQuery CookieBar Plugin
2+
3+
On the 26th of May 2012, the EU government decided it was necessary for every website available inside the EU to have to give visitors the option to allow or disable cookies. While most people saw this as unnecessary and a disruption to collecting analytical data, etc, the EU law was passed. One of the EU's steps towards ruining the internet.
4+
5+
But rather than simply refuse to comply and potentially face consequences in the future, a lot of website owners and developers took the step of implementing code on their websites to give users the option to enable or disable cookies.
6+
7+
## Introduction
8+
9+
The Cookie Bar plugin creates a small bar at the top or bottom of the website with a short message about cookies and accept, decline, and privacy policy buttons.
10+
11+
Once a user has made the decision to either accept or decline, the Cookie Bar slides up, then disappears.
12+
13+
The Cookie Bar can be set up to work in a variety of ways. By default, it uses assumed consent. This means that when a user visits the website, cookies can be set as normal with no interruption. The Cookie Bar is still displayed to provide the user with options for cookies.
14+
15+
It can also be set up to assume refusal. So when a user visits the website, until they press the accept button on the Cookie Bar, no cookies should be set.
16+
17+
You can specify which buttons show on the Cookie Bar. The default is to show the accept and privacy policy buttons and no decline button. This way, assumed consent is used, and the user cannot opt out of cookies. If the user is unhappy about the use of cookies, they can simply leave the website.
18+
19+
The Cookie Bar is also very easy to style. There are just 9 lines of CSS code in total. Changing the heights, widths, background colours, etc. is very quick and easy meaning it can fit in with the website design and colour scheme.
20+
21+
## Installing
22+
23+
To start, download the zip file containing the Cookie Bar plugin, a CSS file and example HTML document. Upload the javascript and CSS files to your website and add them between your head tags. Make sure to download the latest version of jQuery if your website does not already include it.
24+
25+
You will also need to initialise the Cookie Bar, which can be done with the following code (Make sure if you already use $(document).ready() that you only copy what you need of below so you don't have too many $(document).ready()'s).
26+
27+
$(document).ready(function(){
28+
$.cookieBar();
29+
});
30+
31+
Refresh your website, and the Cookie Bar should appear!
32+
33+
A basic setup may look like the following:
34+
35+
<script type="text/javascript" src="/your-js-folder/jquery.js"></script>
36+
<script type="text/javascript" src="/your-js-folder/jquery.cookiebar.js"></script>
37+
<script type="text/javascript">
38+
$(document).ready(function(){
39+
$.cookieBar();
40+
});
41+
</script>
42+
43+
**If the cookiebar does not show, check for any javascript errors.**
44+
45+
**If the cookiebar continues to show after accepting/declining, make sure to remove the option "forceShow" from your code, or set it to "false".**
46+
47+
## Disabling Google Analytics and other cookies
48+
49+
If a user chooses to disable cookies (If you give them that option), you need to make sure that scripts such as Google Analytics need to be disabled.
50+
51+
This can be done by wrapping the code in a simple if statement.
52+
53+
if(jQuery.cookieBar('cookies')){
54+
//Google Analytics or other code here
55+
}
56+
57+
## Options
58+
59+
There are a number of options allowing you to customise how the plugin works:
60+
61+
message: 'We use cookies to track usage and preferences',
62+
acceptButton: true,
63+
acceptText: 'I Understand',
64+
acceptFunction: null,
65+
declineButton: false,
66+
declineText: 'Disable Cookies',
67+
declineFunction: null,
68+
policyButton: true,
69+
policyText: 'Privacy Policy',
70+
policyURL: '/privacy-policy/',
71+
autoEnable: true,
72+
acceptOnContinue: false,
73+
acceptOnScroll: false,
74+
acceptAnyClick: false,
75+
expireDays: 365,
76+
renewOnVisit: false,
77+
forceShow: false,
78+
effect: 'slide',
79+
element: 'body',
80+
append: false,
81+
fixed: false,
82+
bottom: false,
83+
zindex: '',
84+
domain: 'www.example.com',
85+
referrer: 'www.example.com'

index.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5-
<title>PrimeBox CookieBar Example</title>
5+
<title>CookieBar Example</title>
66
<style type="text/css">
77
* {margin:0; padding:0; outline:0; border:0;}
88
body {color:#444444; background:#ffffff; font-size:0.8em; font-family:Verdana,Geneva,Arial,Helvetica,sans-serif;}
@@ -36,7 +36,6 @@ <h1>jQuery CookieBar example</h1>
3636
$.cookieBar();
3737
</code>
3838
<p>If you find that the bar appears even after accepting/declining, make sure "forceShow" is set to <strong>false</strong>.</p>
39-
<p>For more information about PrimeBox's CookieBar plugin, go to <a href="http://www.primebox.co.uk/projects/cookie-bar/">www.primebox.co.uk/projects/cookie-bar/</a>.</p>
4039
</div>
4140
</body>
4241
</html>

0 commit comments

Comments
 (0)