0.1.0 • Published 5 years ago
@usercentrics/uc-headless-sdk v0.1.0
Usercentrics Browser SDK
With the Usercentrics Browser SDK we offer a lightweight library that enables you to build your own fully customized Consent Solution while still using the Usercentrics technology database and tools. We also offer collaborations with Usercentrics Partners which support you in building your customized solution, contact our sales team for more information.
Getting started
- Retrieve an Usercentrics settingsID
- Beta Release request access to the Beta release of this SDK
- Add the package
@usercentrics/uc-headless-sdk
to your project
import {Usercentrics} from '@usercentrics/uc-headless-sdk';
const uc = new Usercentrics('YOUR_USERCENTRICS_SETTINGS_ID');
const initializeUsercentrics = async () => {
const ucInitInfo = await uc.init();
if (ucInitInfo.showBanner === true) {
// Consent UI needs to be shown (e.g. because it's a new visitor of your website)
// ... your FE code goes here
}
}
The Usercentrics constructor supports a second options parameter.
Usercentrics Settings
Exact like the normal Usercentrics integration, the SDK will behave differently based on your adjustments on https://admin.usercentrics.com/. The SDK will for example always mark technologies as accepted that are located in a category marked as "essentiell".
SDK Methods
More information are available in the developer documentation.