libconsent
Adapters

Didomi

Didomi CMP — purposes and vendors, both readable.

npm i @libconsent/didomi
import { ConsentProvider } from "@libconsent/core";
import { didomi } from "@libconsent/didomi";

<ConsentProvider
  adapter={didomi({ apiKey: "00000000-0000-0000-0000-000000000000" })}
>
  {children}
</ConsentProvider>;

Didomi keeps drawing its own notice. The adapter makes what it decides readable from React and maps its actions onto the shared API — and because Didomi reports consent per vendor as well as per purpose, <CookieService id="hotjar"> gets a precise answer instead of falling back to a category.

Options

OptionDefault
apiKey—Required. From Didomi's console; it is in the loader URL.
noticeId—A specific notice, when your account has more than one.
language—Force a language; otherwise Didomi detects it.
src—A different loader URL — self-hosted or pinned.
manualfalseThe script is already on the page.
purposes—Map Didomi purpose ids onto libconsent categories.

Purposes

Didomi's ids for the TCF purposes are recognised:

cookies                            → essential
select_basic_ads                   → marketing
create_ads_profile                 → marketing
select_personalized_ads            → marketing
measure_ad_performance             → marketing
create_content_profile             → functional
select_personalized_content        → functional
use_limited_data_to_select_content → functional
measure_content_performance        → analytics
market_research                    → analytics
improve_products                   → analytics

Notices almost always add custom purposes on top. Those are matched on what their id contains — anything with analytic, statistic or measure counts as analytics, anything with advertis, marketing or targeting as marketing — and you can always be explicit:

didomi({
  apiKey: "…",
  purposes: { my_custom_purpose: "functional" },
});

A category is granted only when every purpose behind it is. Purposes Didomi marks essential, and those established under legitimate interest, count as granted.

Vendors

Vendor answers are reported twice — under Didomi's vendor id and under the name its UI shows — so either works as an alias:

<CookieService id="hotjar" aliases={["c:hotjar-AbCdEf"]}>
  <HotjarSnippet />
</CookieService>

Actions

ActionWhat Didomi does
open()Shows the notice
openSettings()Opens the preferences centre
close()Hides both
acceptAll()setUserAgreeToAll()
rejectAll()setUserDisagreeToAll()
reset()Didomi.reset()

Consent cannot be written field by field from your own UI, so useConsentForm() is not available — use openSettings() to hand over to Didomi's dialog.

On this page