Osano
Osano Cookie Consent — categories, and the US opt-out flag.
npm i @libconsent/osanoimport { ConsentProvider } from "@libconsent/core";
import { osano } from "@libconsent/osano";
<ConsentProvider
adapter={osano({ customerId: "AbCdEfGh", configId: "0000-0000-0000-0000" })}
>
{children}
</ConsentProvider>;Osano keeps drawing its own dialog and drawer. customerId and configId are
the two path segments of the script URL Osano gives you — paste the whole thing
as src if you'd rather not split it up.
Options
| Option | Default | |
|---|---|---|
customerId | — | The first path segment of your Osano script URL. |
configId | — | The UUID after it. |
src | — | The whole script URL instead. Takes precedence. |
manual | false | The script is already on the page. |
categories | — | Map Osano's categories onto libconsent's. |
Categories
ESSENTIAL → essential
STORAGE → functional
PERSONALIZATION → functional
ANALYTICS → analytics
MARKETING → marketingOPT_OUT is the US "do not sell" flag rather than a kind of storage, so it is
reported as a service instead:
const optedOut = !useHasConsent("opt-out");Any other category your Osano configuration adds is reported the same way, under its own lower-cased name.
What it can do
open() shows the dialog, openSettings() opens the drawer, close() hides
both. Osano has no public call to accept or reject on the user's behalf, so
acceptAll(), rejectAll() and reset() are absent — useConsent().supports
reports that, and calling them warns in development rather than failing quietly.
How a decision is detected
getConsent() returns Osano's defaults before the user has touched anything,
which look exactly like a real answer. So hasDecision follows Osano's own
osano_consentmanager cookie, and flips as soon as osano-cm-consent-saved
fires.