Skip to content

contensio/plugin-cookie-consent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cookie Consent - Contensio plugin

Latest Version License

GDPR-compliant cookie consent banner for Contensio. Fully customizable text, accept/decline buttons, privacy policy link, position (top or bottom), and dark/light style. Visitor preference is stored in localStorage - no database table required.

Install

Option A - Composer (developers)

composer require contensio/plugin-cookie-consent

Then in the Contensio admin: Plugins → Enable next to "Cookie Consent".

Option B - ZIP upload

  1. Download the latest release ZIP from the releases page
  2. In Contensio admin: Plugins → Install Plugin → upload the ZIP
  3. Click Enable

Configure

After enabling:

  1. Go to Tools → Cookie Consent (or Configuration → Cookie Consent)
  2. Set your banner text, accept/decline labels, and optional privacy policy URL
  3. Choose position (bottom or top) and style (dark or light)
  4. Use the live preview to see your changes before saving
  5. Save - the banner appears immediately on your site

How it works

  • The banner is injected into every frontend page via the contensio/frontend/body-end render hook. No theme files are modified.
  • When a visitor clicks Accept or Decline, the preference is saved in localStorage under the key contensio_consent with a value of accepted or declined.
  • On subsequent page loads, the banner checks localStorage first and stays hidden if a preference already exists.
  • The banner never appears for admin users browsing the frontend while logged in to the admin panel (they have already interacted with it as visitors if needed).

Respecting consent in other plugins

Other plugins that set cookies or load tracking scripts (e.g. Google Analytics) can check the visitor's preference before running:

if (localStorage.getItem('contensio_consent') === 'accepted') {
    // load analytics, set cookies, etc.
}

What this plugin does NOT do

  • It does not automatically block cookies set by other scripts. It is a notice and preference mechanism - you are responsible for conditionally loading cookie-setting scripts based on the stored preference.
  • It does not distinguish between cookie categories (necessary, analytics, marketing). If you need granular category consent, consider extending this plugin or using a dedicated consent management platform.

Architecture notes

  • Settings stored as a single JSON blob in the core settings table (module = cookie_consent, setting_key = config). No migrations needed.
  • Frontend banner is pure HTML + inline CSS + a small inline <script> block (~40 lines). No JavaScript framework, no external requests.
  • Admin settings page includes a live preview that updates as you type.
  • A settings hub card is injected into the admin Configuration page via the contensio/admin/settings-cards hook.

License

AGPL-3.0-or-later. Copyright © 2026 Iosif Gabriel Chimilevschi. Operated by Host Server SRL.

About

GDPR-compliant cookie consent banner for Contensio. Lightweight, no dependencies.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors