Usercentrics
Usercentrics CMP — Browser SDK v2 and v3.
bun add @libconsent/usercentricsimport { usercentrics } from "@libconsent/usercentrics";
<ConsentProvider adapter={usercentrics({ settingsId: "AbCdEf123" })}>
{children}
</ConsentProvider>;Usercentrics keeps drawing its own banner. The adapter makes its answer readable from React and maps its actions onto the shared API.
Options
| Option | Default | |
|---|---|---|
settingsId | — | Required. The Settings ID from the admin interface. |
version | "v3" | "v2" loads the legacy app.usercentrics.eu loader. |
language | — | Force a language; otherwise the CMP detects it. |
src | — | A different loader URL — self-hosted or pinned. |
manual | false | The script is already on the page. |
categories | — | Map Usercentrics category slugs onto libconsent categories. |
Categories
Usercentrics ships essential, functional and marketing; most setups add
an analytics-shaped one. These slugs are recognised:
essential, necessary → essential
functional, preferences → functional
marketing → marketing
analytics, performance, statistics → analyticsRenamed or added categories in your configuration:
usercentrics({
settingsId: "AbCdEf123",
categories: { werbung: "marketing", messung: "analytics" },
});Anything unmapped keeps its own slug, so useHasConsent("your-slug") still
works.
Services
Services are reported under both their Usercentrics id and their display name, so catalog ids usually match as-is:
<CookieService id="google-analytics">…</CookieService>If your Usercentrics configuration names it something else, add the alias:
<CookieService id="google-analytics" aliases={["Google Analytics (GA4)"]}>Actions
open() shows the first layer, openSettings() the second, acceptAll() and
rejectAll() map to acceptAllConsents / denyAllConsents, and reset()
restarts the CMP. setConsent is not available, so build your preferences link
around openSettings().
Consent Mode
Usercentrics writes Google Consent Mode itself when you enable it there, so
libconsent leaves it alone. Set consentMode={true} on the provider to write
the signals from libconsent instead.