Socket
Socket
Sign inDemoInstall

@envato/cookie-consent

Package Overview
Dependencies
1
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@envato/cookie-consent

Some helper functions to deal with cookie-consent


Version published
Maintainers
1
Weekly downloads
359
increased by20.88%

Weekly downloads

Readme

Source

Overview

The npm package for cookie consent helpers. These functions are tighly coupled to using the cookiebot api at the moment.

Usage

Installation

npm install @envato/cookie-consent --save
# or using `yarn`
yarn add @envato/cookie-consent

Examples

import { Consent, consented, deferRun } from '@envato/cookie-consent'

// Check for consent inline (note that on the initial page load this function may return false)
if (consented(Consent.statistics)) {
  // Do something..
}

// Manually parse and check the consent type in the CookieConsent cookie
checkCookieConsent(Cookies.get('CookieConsent'), Consent.statistics)

// Run function after consent
deferRun(() => {
  doSomething()
}, Consent.marketing)

// Types of consent we support:
Consent.marketing
Consent.statistics
Consent.preferences
Consent.necessary

Override CSS

There is a cookiebot.css in the module, you can include it to partially override the default Cookiebot style.

The CLS fix code snippet

The file clsFixSnippet.ts contains a code snippet that fixes a CLS issue caused by the cookiebot dialog. It's being exported as a string. When including the code in your app, make sure it runs before the main cookiebot code.

To publish

Run

npm version (patch/minor/major)
npm publish

FAQs

Last updated on 12 May 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc