New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cookie-consent-js

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cookie-consent-js

A simple dialog and framework to handle the German and EU law (may 2020) about cookies in a website

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
257
increased by49.42%
Maintainers
1
Weekly downloads
 
Created
Source

A simple dialog and framework to handle the German and EU law (may 2020) about cookies in a website

Demo Page

Usage

Include the js and css

<link rel="stylesheet" href="src/cookie-consent.css"/>
<script src="./src/cookie-consent.js"></script>

Initialize the script

var cookieConsent = new CookieConsent(props)

In props you should at least define privacyPolicyUrl. See below "Configuration properties".

JavaScript API

cookieConsent.reset()

Read status

cookieConsent.isTrackingCookieAllowed()

Configuration properties

With default values.

this.props = {
    buttonPrimaryClass: "btn btn-primary",
    buttonSecondaryClass: "btn btn-secondary",
    privacyPolicyUrl: "privacy-policy.html",
    autoShowModal: true, // disable autoShowModal on the privacy policy page, to make this page readable
    lang: navigator.language, // the language, in which the modal is shown
    content: { // the content in all needed languages
        de: {
            title: "Cookie-Einstellungen",
            body: "Wir nutzen Cookies, um Inhalte zu personalisieren und die Zugriffe auf unsere Website zu analysieren. " +
                "Sie können wählen, ob Sie nur für die Funktion der Website notwendige Cookies akzeptieren oder auch " +
                "Tracking-Cookies zulassen möchten. Weitere Informationen finden Sie in unserer --privacy-policy--.",
            privacyPolicy: "Datenschutzerklärung",
            buttonAcceptAll: "Alle Cookies akzeptieren",
            buttonAcceptTechnical: "Nur technisch notwendige Cookies akzeptieren"
        },
        en: {
            title: "Cookie settings",
            body: "We use cookies to personalize content and analyze access to our website. " +
                "You can choose whether you only accept cookies that are necessary for the functioning of the website " +
                "or whether you also want to allow tracking cookies. For more information, please refer to our --privacy-policy--.",
            privacyPolicy: "privacy policy",
            buttonAcceptAll: "Accept all cookies",
            buttonAcceptTechnical: "Only accept technically necessary cookies"
        }
    },
    modalId: "cookieConsentModal", // this may not be changed
    cookieName: "cookie-consent-accept-all"  // this may not be changed
}
Disable autoShow

You should disable autoShowModal in the privacy policy page to make this page readable.

var cookieConsent = new CookieConsent({linkPrivacyPolicy: "privacy-policy.html", autoShowModal: false})

Keywords

FAQs

Package last updated on 05 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc