Socket
Book a DemoInstallSign in
Socket

@contentful/experience-consent-manager

Package Overview
Dependencies
Maintainers
113
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@contentful/experience-consent-manager

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

unpublished
latest
Source
npmnpm
Version
2.0.2
Version published
Weekly downloads
0
Maintainers
113
Weekly downloads
 
Created
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

Package last updated on 18 Nov 2021

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