Cookie policy
The cookie_policy object describes the cookie policy for the current session, including user consent and allowed cookie types.
Usage Example
{%- comment -%} Show cookie policy status {%- endcomment -%}
{% if cookie_policy.value == 'all' %}
<p>All cookies are allowed.</p>
{% elsif cookie_policy.value == 'required' %}
<p>Only required cookies are allowed.</p>
{% elsif cookie_policy.value == 'custom' %}
<p>Custom cookie policy. Consents: {{ cookie_policy.consents | join: ', ' }}</p>
{% else %}
<p>Cookie policy not set. Please ask the user for consent.</p>
{% endif %}Properties
value
Returns the cookie policy value for the session (e.g., null, required, all, custom).
consents
Returns the user’s consent choices for the cookie policy. If set to custom, returns the user’s consents.