Cookie Consent

Customize Choices

Pass options on the opening {{ cookie_consent }} tag.

phpresources/views/partials/cookies-popup.php
{{ cookie_consent  title="Cookie choices"  message="Optional scripts only run after you allow them."  policy_url="/privacy-policy/"}}  <section>    ...  </section>{{ /cookie_consent }}

Categories#

Necessary cookies are always required. Optional categories default to:

  • preferences
  • analytics
  • marketing

Choose a different set with categories:

php
{{ cookie_consent categories="analytics,marketing" }}  <section>    ...  </section>{{ /cookie_consent }}

Category Labels#

Change labels and descriptions per category:

php
{{ cookie_consent  analytics_label="Website analytics"  analytics_description="Helps us understand which reviews people read."  marketing_label="Embedded media"  marketing_description="Allows third-party embeds and advertising tools."}}  <section>    ...  </section>{{ /cookie_consent }}

Inside {{ categories }}, {{ label }} and {{ description }} print those values.

Storage Key#

The default storage key is cookie-consent:v1.

Change it when consent categories or meaning change:

php
{{ cookie_consent storage_key="cookie-consent:v2" }}  <section>    ...  </section>{{ /cookie_consent }}

Changing the key makes visitors choose again.

Minimal Renderer#

The old non-paired tag still works:

php
{{ cookie_consent title="Cookie choices" }}

Use the paired tag when you want full control over markup.