Skip to Content

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

consents

Returns the user’s consent choices for the cookie policy. If the policy is set to custom, this returns the user’s consents.

value

Returns the cookie policy for the session. Possible values:

  • null: Should be asked from the user
  • required: Only required cookies allowed
  • all: All cookies are allowed
  • custom: Custom cookie policy (see consents for details)
Last updated on