Quickstart
Installation
Initialize the Runtime
getOrCreateConsentRuntime() creates a consent client and a Zustand vanilla store in a single call. The store holds all consent state and exposes methods for checking, setting, and subscribing to consent changes.
Info
Hosted mode is the recommended production setup because the backend resolves jurisdiction and translations, stores consent decisions outside the current browser, and can re-sync after temporary outages.
Info
You can switch to mode: 'offline' for local-only storage, demos, or static previews, but that removes backend audit history, automatic jurisdiction detection, and server-side consent awareness. Review Client Modes before using offline mode in production.
Subscribe to State Changes
The store is a Zustand vanilla store. Use subscribe() for UI and general state updates, subscribeToConsentChanges() for change-only consent integrations, and getState() to read the current state:
Check and Set Consent
Minimal Consent Prompt
Here's a bare-bones example using the store to drive a consent prompt — no framework required:
Verify It Works
Open the browser console and inspect the store state:
Info
No UI included — the c15t core package is fully headless. See Building UI for creating your own components, or use @c15t/react / @c15t/nextjs for pre-built UI.
Optional: Install Agent Skills
Install c15t agent skills to let AI agents help with styling, i18n, scripts & other configuration.
See AI Agents for bundled package docs and agent skills.
Next Steps
- Client Modes — Choose between hosted, offline, or custom backend
- Store API — Full reference for store state and actions
- Script Loader — Gate third-party scripts behind consent
- Building UI — Create your own consent components
- AI Agents — Get bundled package docs and reusable agent skills for c15t