window.KatlaConsent for programmatic access to consent state.
Prerequisites
- The consent widget script installed on your page
Reading consent state
Checking specific cookies or categories
Setting consent programmatically
Listening for changes
Google Consent Mode
If you use Google Analytics or Google Ads and want to signal consent state via Google Consent Mode v2, usesetupGoogleConsentMode() from the SDK:
denied for all Google parameters, then automatically updates them when the visitor makes a consent choice. See the Google Consent Mode guide for full details.
Regulation and GPC
Properties
| Property | Type | Description |
|---|---|---|
siteId | string | Your site’s UUID |
categories | string[] | All available cookie categories |
Methods
| Method | Returns | Description |
|---|---|---|
acceptAll() | void | Accept all cookie categories |
rejectAll() | void | Reject all non-functional cookies |
acceptCategories(categories) | void | Accept specific categories |
optOutOfSale() | void | CCPA: opt out of sale/sharing of personal information |
hasConsent() | boolean | Whether visitor has made a consent choice |
getConsent() | object | null | Current consent state ({ type, categories }) |
getAllowedCategories() | string[] | Currently allowed categories |
isCategoryAllowed(category) | boolean | Check if a specific category is allowed |
isCookieAllowed(name) | boolean | Check if a specific cookie is allowed |
isGPCEnabled() | boolean | Whether browser GPC signal is active |
getRegulation() | string | Active regulation ('gdpr' or 'ccpa') |