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

@demos-europe/dp-consent

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@demos-europe/dp-consent

A cookie consent solution.

  • 1.3.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

This is a small script that allows to manage cookie consent for optional cookies.

Usage

import { dpConsent } from 'cookie-consent/dist/dp-consent.es.min.js'

// initializing dp consent
const consent = dpConsent({
  notice: '', // text to be shown in the cookie slideout
  optionalCookies: [
    {
      name: '', // the cookie's name
      explanation: '' // what does this cookie do
    },
    { ... }
  ], // an array of optional cookies
  necessaryCookies: [ /* same structure as above */ ], // an array of necessary cookies
  onGrantConsent: () => {}, // callback to be executed when consent is granted
  onRevokeConsent: () => {} // callback to be executed when consent is revoked
})

// adjusting consent settings
consent.adjustSettings()

How it works?

Dp-Cookie-Consent will show a slideout providing options to accept all cookies or to change cookie settings. If all cookies are accepted the onGrantConsent-callback will be executed and all optional cookies can be set. If the user opts to change cookie settings a modal will be opened that presents the user with a list of all necessary and all optional cookies. If the user selects optional cookies and saves these settings, the onGrantConsent-callback will be executed. If the user doesn't select optional cookies the onRevokeConsent-callback will be executed. A cookie will be set that remembers the user's choice. The cookie expires within one year.

Keywords

FAQs

Package last updated on 06 Aug 2024

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