New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@usercentrics/cmp-browser-sdk

Package Overview
Dependencies
Maintainers
4
Versions
212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@usercentrics/cmp-browser-sdk

Usercentrics CMP Browser SDK

  • 0.3.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6K
decreased by-42.78%
Maintainers
4
Weekly downloads
 
Created
Source

Usercentrics CMP Browser SDK

With the Usercentrics CMP Browser SDK our aim is to provide a lightweight library which enables you to build your own fully customized Consent Solution while still leveraging the Usercentrics service database and tools.

We also offer collaboration possibilities with Usercentrics Partners who are able to support you in building your own customized solution. Contact our sales team for more information.

Installing the dependency

npm install @usercentrics/cmp-browser-sdk --save

NOTE: We currently offer the SDK only as a CommonJS package.

Initialization

import Usercentrics, { INITIAL_VIEW } from '@usercentrics/cmp-browser-sdk';

const UC = new Usercentrics('YOUR_USERCENTRICS_SETTINGS_ID');

UC.init().then(initialView => {
  // getCategories() returns all categories' and data processing services' information
  const categories = UC.getCategories();
  // getSettings() returns all Usercentrics settings you need for your custom solution
  const settings = UC.getSettings();

  switch (initialView) {
    case INITIAL_VIEW.FIRST_LAYER:
      // Show first layer (i.e. privacy banner)
      return;
    case INITIAL_VIEW.PRIVACY_BUTTON:
      // Show privacy button
      return;
    case INITIAL_VIEW.NONE:
    default:
      // Show nothing
      return;
  }
});

The constructor also supports an optional Options parameter.

Changing the language

import Usercentrics, { INITIAL_VIEW } from '@usercentrics/cmp-browser-sdk';

const UC = new Usercentrics('YOUR_USERCENTRICS_SETTINGS_ID');

UC.init().then(initialView => {
  /**
   * ...
   */

  UC.changeLanguage('NEW_LANGUAGE').then(() => {
    // Remember to fetch new categories and settings
    const categories = UC.getCategories();
    const settings = UC.getSettings();
  });
});

Documentation

Documentation can be found on our documentation website.

FAQs

Package last updated on 10 Mar 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc