Skip to content

LMG Consent 1.2.0 — CIPA hard script-blocking

Choose a tag to compare

@ericisaksen ericisaksen released this 30 Jun 14:21
· 2 commits to main since this release

CIPA prior-blocking for Google Analytics / GTM

Previously the plugin relied solely on Google Consent Mode v2. Consent Mode does not stop GA4 from firing before consent — it only suppresses cookies, while still transmitting the visitor's IP, page URL, referrer, and user-agent to Google as "cookieless pings." That fails CIPA's prior-consent standard.

This release adds true prior-blocking: the plugin now physically prevents Google's tracking loaders from fetching or executing until the visitor opts in.

What changed

  • New LMG_Consent_Blocker neutralizes the external Google loader scripts (gtag/js, gtm.js, analytics.js, ga.js) to type="text/plain" before the page is sent — the browser never fetches or runs them pre-consent.
  • Works regardless of how the tag was added — Genesis Simple Hooks and Elementor custom code are both covered (no per-site changes needed).
  • banner.js reactivates a loader only once its category is granted (on decision, and on load for returning visitors).
  • Inline gtag('config', …) is left in place but inert — harmless without the loader.
  • Cache-safe: the blocked state is what gets cached; unblocking is per-visitor JS.

Category mapping: gtag.js / analytics.js / ga.js → Analytics; gtm.js → Marketing.

New site overrides (optional, in wp-config.php)

  • define('LMG_CONSENT_BLOCKING', false); — disable blocking on a problem site.
  • define('LMG_CONSENT_EXTRA_PATTERNS', [['regex'=>'~…~i','category'=>'analytics']]); — block a non-standard loader.

Compatibility

No back-compat changes — cookie/option/table keys, the m_consent:change / lmg_consent:change events, and the [m_cookie_preferences] / [lmg_cookie_preferences] shortcodes are unchanged.