Consenti

Frontend-Only Mode

Most open-source cookie consent tools are frontend-only by design — a banner script, a preference toggle, done. @consenti/ui works exactly the same way when you run it standalone: npm install @consenti/ui, zero backend, zero runtime dependencies. The difference is what you get once it's running — a widget API surface, event system, and integration ecosystem closer to what a hosted SaaS CMP offers, not what a banner-only widget offers.

ℹ️Everything on this page works with @consenti/ui alone — no @consenti/api, no server, no account. Add the backend later, any time, without changing your widget config, if you want server-side consent records or a dashboard. See Consenti, What-Why-How? for how the two packages relate.

Why frontend-only Consenti is a different tier

Compared to banner-only widgets, Consenti is genuinely good at the one thing they do — standalone widget covers a lot more ground:

CapabilityConsenti (frontend-only)Typical banner-only widget
Widget API methods31 — getConsent, hasConsent, showModal, reConsent, setProfile, switchLocale, and moreA handful — usually just accept/reject/show
DOM events8 — bannerInitialized, consentSubmitted, forgotten, parentalConsentRequired, and moreNone, or a single callback option
Framework integrationNative React hooks, Vue composables, Angular services — plus Vanilla ESM/UMDVanilla script tag; framework wrapping is on you
Analytics/tag-manager mappersGTM/Consent Mode v2, Adobe, Meta, Microsoft Clarity, Twilio Segment, generic purpose/category — typed, built inUsually none — you write the mapping code yourself
AccessibilityFocus trap, ARIA roles, keyboard nav, screen-reader announcements, targeting WCAG 2.x AAVaries widely, rarely a stated target
i18nPer-locale translations with BCP 47 resolution (exact → language prefix → default)Manual string replacement, if supported at all
Global Privacy Control (GPC)Built in, with `true` / `'strict'` modesRarely built in
Cross-tab syncBuilt in via BroadcastChannelNot typically handled
Cookie auto-discovery`@consenti/scanner` — local CLI crawler, run on demand or in CINot included — declare cookies by hand
Runtime dependenciesZero — browser built-ins onlyUsually also zero — this one is a tie

Get started

API surface

  • API Methods — all 31 methods: state (getConsent, hasConsent, isCategoryGranted...), UI control (showModal, hideBanner...), lifecycle (reConsent, forgetMe, destroy...)
  • DOM Events — all 8 events, plus ConsentScript/CategoryScript/ConsentAction/BannerTrigger helpers and declarative data-consenti-* attribute-based script gating, no hand-written JS required
  • Plugin APIConsentiWidgetAPI reference, lifecycle hooks, example plugins

Framework integrations

Analytics & tag-manager integrations

Typed consent mappers ship in @consenti/ui for each of these — no hand-rolled mapping code:

Theming & configuration

Cookie discovery

No crawler ships inside the widget itself — that would bloat the bundle for a task you only need occasionally. Instead, @consenti/scanner is a separate, local CLI: it crawls your site under none/reject-all/accept-all consent states and reports undeclared third-party trackers, fully offline. Run it once during setup, or wire it into CI.