Natural Preference for Minification
Have ideas to improve npm?Join in the discussion! »

bootstrap-cookie-consent-settings

1.0.8 • Public • Published

bootstrap-cookie-consent-settings

A modal dialog (cookie banner) and framework to handle the German and EU law (as written by EuGH, 1.10.2019 – C-673/17) about cookies in a website. Based on Bootstrap 4.

Usage

Construct

Initialize the cookie consent framework with the constructor

var cookieSettings = new BootstrapCookieConsent(props)

You may configure the framework with the props object. The default configuration is

this.props = {
    autoShowDialog: true, // disable autoShowModal on the privacy policy and legal notice pages, to make these pages readable
    lang: navigator.language, // the language, in which the modal is shown
    languages: ["en", "de"], // supported languages (in ./content/), defaults to first in array
    contentURL: "./content/", // this URL must contain the dialogs content in the needed languages
    cookieName: "cookie-consent-settings",  // the name of the cookie in which the configuration is stored as JSON
    cookieStorageDays: 365 // the duration the cookie configuration is stored on the client
}

Show dialog again

On a new visit the dialog is shown automatically. For reconfiguration show the Dialog again with

cookieSettings.showDialog()

Read the settings

Read all cookie settings with

cookieSettings.getSettings()

It should return some JSON like

{"necessary":true,"analysis":false}

or undefined, before the user has choosen his cookie options.

Read a specific cookie setting with

cookieSettings.getSettings('analysis')

for the analysis cookie settings. Also returns undefined, before the user has choosen his cookie options.

Install

npm i bootstrap-cookie-consent-settings

DownloadsWeekly Downloads

23

Version

1.0.8

License

MIT

Unpacked Size

23.8 kB

Total Files

10

Homepage

shaack.com

Last publish

Collaborators

  • avatar