Checking Consent

Use has() for flexible consent checks with AND, OR, and NOT logic. Check if any consent exists with hasConsented().

has(condition)

The has() method evaluates whether the current consent state satisfies a condition. It supports simple category checks and complex logical expressions.

Simple Check

AND Logic

All conditions must be true:

OR Logic

At least one condition must be true:

NOT Logic

Negates a condition:

Nested Conditions

Combine operators for complex logic:

HasCondition Type

hasConsented()

Returns true if the user has made any consent choice (accepted, rejected, or customized). Returns false if no consent has been recorded yet.

getDisplayedConsents()

Returns the consent types that should be displayed in the UI (based on active consentCategories and each type's display property):