WP Manifestindependent plugin directory
manifest / unclassified / lcmt-dev-consent

LCMT Consent

Lightweight, performance-focused cookie consent banner. Loads banner JS/CSS only when consent is pending; injects accepted services server-side.

by Amaury Lecomte · github.com/brukols/lcmt-dev-consent · website

★ 0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/brukols/lcmt-dev-consent/archive/refs/heads/main.zip

Lightweight, performance-focused cookie consent banner. JS/CSS are loaded only while consent is pending; accepted services are injected server-side from wp_head afterwards.

Description

  • Banner JS/CSS load only on the very first visits (while the user hasn't yet decided).
  • Once the user has accepted/refused, scripts for allowed services (GTM, GA4, Facebook Pixel, Matomo) are injected directly in <head> — no extra runtime.
  • Configurable via Settings → Cookie Consent: texts, position, colors, services.
  • Extensible via the lcmt_dev_consent_services PHP filter for custom services.
  • Polylang / WPML aware — admin-entered strings are auto-registered for translation.

Developer API

Check consent anywhere in your theme/plugin:

if ( \LcmtDev\Consent\Consent::isAllowed('googletagmanager') ) { /* ... */ }

Register a custom service:

add_filter('lcmt_dev_consent_services', function ($services) { $services[] = [ 'key' => 'hotjar', 'name' => 'Hotjar', 'category' => 'analytic', 'data' => ['id' => '000000'], 'needReload' => true, 'inject_php' => fn($data) => "", ]; return $services; });

Listen for client-side acceptance (first visit only):

document.addEventListener('lcmt-consent:accepted', (e) => { console.log('Accepted:', e.detail.key, e.detail.data); });

Changelog

1.5.4

  • Change: Google Site Kit advanced mode now respects an explicit refusal — once the visitor refuses every consent signal, Site Kit's tag is blocked from the next page on, so Google receives nothing more. Before any choice, cookieless pings still load as before.

1.5.3

  • Change: while Google Site Kit inserts its tag, the plugin's Google Analytics and Google Tag Manager services are switched off (greyed out in Settings → Services, "Managed by Google Site Kit"), whatever their ID, so visits are never counted twice. Their settings are kept and apply again without Site Kit.

1.5.2

  • Fix: "Check for updates" crashed with "Class Parsedown not found" — the update checker's vendor files were missing from the 1.5.0 and 1.5.1 zips. Sites on 1.5.0 or 1.5.1 must install 1.5.2 by hand once.

1.5.1

  • New: banner shadow setting (Appearance → Shadow: none, light, medium, strong) to set the banner apart from a white page.
  • Improve: Google Consent Mode — the signals accepted together are sent as a single consent update, so Google never receives a partial consent state.

1.5.0

  • New: updates from the GitHub releases — new versions show up in Dashboard → Updates like any wordpress.org plugin.
  • Change: the plugin is now displayed as "LCMT Consent" (folder, slug and settings unchanged).

1.4.0

  • New: Google Site Kit compatibility with Google Consent Mode v2. When Site Kit inserts its Google tag, the banner shows the 4 consent signals and sends them to gtag before Site Kit's tag. Basic mode (default): Site Kit's tag is blocked until a signal is granted and loaded on the first accept without reload. Optional advanced mode: the tag always loads with every signal denied. Site Kit settings are never modified.

1.3.1

  • Improve: the consent preferences panel now caps its scrollable body at 500px so a long list of services no longer stretches the panel toward full viewport height.

1.3.0

  • New: configurable title icon on the consent banner + panel — choose a built-in cookie icon (default), the 🍪 emoji, a custom image (media library), or none, from Settings → Cookie Consent → Appearance.

1.2.0

  • New: Google Maps consent gate — embedded maps are replaced by a consent placeholder until the visitor accepts (mirrors the YouTube gate). Detects raw Google Maps iframes in content/widgets and theme templates via GoogleMapsEmbed::render().
  • Change: YouTube and Google Maps services now ship disabled by default (opt-in from Settings → Cookie Consent → Services).
  • Fix: the "Gérer les cookies" reopen panel now renders in the current page language on multilingual sites instead of the site default.
  • Build: npm run package produces a clean, upload-ready plugin zip (dev files excluded).

1.0.0

  • Initial release.