Minimal Cookie Consent Banner & Box In JavaScript – ez-consent

Category: Javascript | June 2, 2020
Author: undergroundwires
Views Total: 143 views
Official Page: Go to website
Last Update: June 2, 2020
License: MIT


Minimal Cookie Consent Banner & Box In JavaScript – ez-consent


ez-consent is a tiny JavaScript library that creates a non-intrusive cookie ? consent banner or notice box to inform the visitors how your website uses cookies.

How to use it:

1. Install & download the package.

$ npm install ez-consent --save

2. Import the ez-consent library.

import { ez_consent } from './src/ez-consent.js';

3. Or load the ez-consent.min.js in the document.

<script src="[email protected]/dist/ez-consent.min.js"></script>

4. Load a theme of your choice:

  • box-bottom-left.css: Notice Box
  • subtle-bottom-right.css: Bottom-right banner
<link rel="stylesheet" href="box-bottom-left.min.css" />
<link rel="stylesheet" href="subtle-bottom-right.css" />

5. Initialize the library and replace the privacy page URL:

  privacy_url: '' 

6. Determine whether or not to always show the cookie consent notice. Default: false (Only displayed on the first visit).

  always_show: true,
  privacy_url: '' 

7. Customize the cookie consent notice.

  always_show: true,
  privacy_url: '',
  texts: {
    main: "We use cookies",
        ok: "ok",
        more: "more"

You Might Be Interested In:

Leave a Reply