@contentful/experience-consent-manager
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 '@contentful/experience-consent-manager/dist/style.css';
import { createConsentManager, ConsentCategory } from '@contentful/experience-consent-manager';
const manager = createConsentManager({
appKey: 'myApp',
osano: {
configId: 'xxxxxxxx',
allowedCategories: [ConsentCategory.ESSENTIAL, ConsentCategory.ANALYTICS],
},
});
manager.initialize({
getUserConsentData: () => {
return user.cookieConsentData;
},
onConsentChanged: (consent) => {
},
onError: (error) => {
},
});