Socket
Socket
Sign inDemoInstall

@contentful/experience-consent-manager

Package Overview
Dependencies
148
Maintainers
113
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @contentful/experience-consent-manager

A package for handling User Consent Management via [Osano](https://osano.com/).


Version published
Maintainers
113
Created

Readme

Source

A package for handling User Consent Management via Osano.

What does it do?

  • Handles loading of Osano script
  • Provides Custom CSS to match Forma36 (v3) styles.
  • Provides useful helpers e.g. isAnalyticsEnabled
  • Provides useful callbacks e.g. onConsentChanged and onError

Installation

yarn add @contentful/experience-consent-manager

Usage

// Import this unless you want to provide your own CSS
import '@contentful/experience-consent-manager/dist/style.css';

import { createConsentManager, ConsentCategory } from '@contentful/experience-consent-manager';

const manager = createConsentManager({
  appKey: 'myApp', // e.g. compose, userInterface, launch ..etc
  osano: {
    // Required
    configId: 'xxxxxxxx',
    // Optional (but Recommended)
    allowedCategories: [ConsentCategory.ESSENTIAL, ConsentCategory.ANALYTICS],
  },
});

// Later on in your app (but as EARLY AS POSSIBLE)
manager.initialize({
  // Required
  getUserConsentData: () => {
    return user.cookieConsentData;
  },
  // Optional (but Recommended)
  onConsentChanged: (consent) => {
    // You probably want to save this to /users/me under appKey namespace.
  },
  onError: (error) => {
    // Log this somewhere, e.g. Sentry?
  },
  // ...
  // ...
  // For the full list of options see src/ConsentManager.ts
});

FAQs

Last updated on 18 Nov 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