Giter VIP home page Giter VIP logo

ihavecookies's Introduction

jQuery Cookie Consent Plugin

A lightweight jQuery plugin that displays a cookie ๐Ÿช consent message as required by EU regulation. The plugin displays a message on the user's first visit to your website and, by default, again 30 days after their last visit.

The visitor must click the accept button within the popup for the cookie to be set thus granting their consent (GDPR).

Usage

Download the latest version and include it within your page along with jQuery (1.7.4 or later).

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.x.x/jquery.min.js"></script>
<script type="text/javascript" src="jquery.ihavecookies.min.js"></script>

Then initialise the plugin using:

$('body').ihavecookies();

This will append the cookie popup to the <body> tag with the default settings and message.

Settings

There are a number of options available to help with customisation:

$('body').ihavecookies({
    // A custom title for the popup
    title: "Cookies & Privacy",

    // Add your own cookie message here, if you prefer not to use the
    default one. HTML can be included within this message.
    message: "Cookies enable you to use shopping carts and to personalize
              your experience on our sites, tell us which parts of our
              websites people have visited, help us measure the effectiveness
              of ads and web searches, and give us insights into user
              behavior so we can improve our communications and products.",

    // Link to your privacy policy for more information
    link: "/privacy-policy",

    // Time before the popup is displayed after page load (in milliseconds)
    delay: 2000,

    // Days for the cookie to expire
    expires: 30
});

Styling

The plugin doesn't include any CSS so it can be styled to fit in with your websites look and feel. The cookie message has an ID of #gdpr-cookie-message.

Cookie

When the visitor accepts the message, the cookie cookieControl with value true is set. This will enable you to perform additional checks where necessary within your application (with regard to GDPR regulations).

Example

An example of the cookie consent message can be viewed at https://iamketan.com.au.

Author

Ketan Mistry (@ketanumistry)

License

This plugin is available under the MIT license.

ihavecookies's People

Contributors

ketanmistry avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.