Skip to content

A jQuery plugin dedicated to create a simple and customisable cookie consent banner

License

Notifications You must be signed in to change notification settings

kevinmeunier/jquery-serialcookie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jQuery serialcookie - Lightweight cookie consent banner

About jQuery serialcookie

The plugin provides an easy way to implement a cookie consent banner to your website. The messages are easily customisable and new language translations can be added. This is a lightweight version of the cookie consent, for large companies they might need the "Edit preferences" option to let the user customize what he wants to accept/reject. Additional languages can be added by using the settings. Note that jQuery serialcookie is shared for inspirational and development purpose.

Demonstration

See the project page for a demonstration.

Compatibility

jQuery serialcookie has been tested in: IE, Edge, Chrome (mobile included), Firefox (mobile included), and Safari (mobile included).

Self-Hosted

Download and save one of two available files to include serialcookie to your page, either the development or the minified version. Also, you can visit the project page to copy what you need.

<script src="jquery.serialcookie.min.js"></script>
<link href="jquery.serialcookie.css" rel="stylesheet">

Due to the lightweight CSS code, it's recommended to copy/paste the CSS code into your general stylesheet.

Make sure jQuery is properly loaded before using jQuery serialcookie.

Basic Usage

The basic usage of serialcookie is pretty easy, just start using jQuery serialcookie by calling it after page load.

$(document).ready(function(){
  // jquery.serialcookie initialisation
  $.serialcookie({
    callback: function(isAccepted){
      if( isAccepted ){
        // Google Analytics
        console.log('Loading Google Analytics script..');
      }
    }
  });
});

Configuration Parameters

The following configurations is available by default:

Name Type Default Description
lanug string 'auto' The autodetection is based on the LANG attribute of the HTML tag
callback function 'function(isAccepted){}' Essential fn to call the script that are using cookies
template string See jquery.serialcookie.js The HTML template where the translations will be injected
translations object See jquery.serialcookie.js The translations in each language

Bugs / Feature request

Please report bugs and feel free to ask for new features directly on GitHub.

License

jQuery serialcookie is licensed under MIT license.

About

A jQuery plugin dedicated to create a simple and customisable cookie consent banner

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages