soderlind / kjeks-google
Google Consent Mode v2 for Kjeks: wires GA4 and Google Tag Manager to the visitor's Kjeks consent choices.
Package info
github.com/soderlind/kjeks-google
Type:wordpress-plugin
pkg:composer/soderlind/kjeks-google
Requires
- php: >=8.3
- soderlind/wordpress-github-updater: ^2.0
Requires (Dev)
- brain/monkey: ^2.6
- pestphp/pest: ^3.5
README
Google Tag Manager and Google Analytics 4 for Kjeks, wired through Consent Mode v2. Requires the Kjeks plugin.
Part of the kjeks family — an adapter over the Kjeks public API. See the kjeks ecosystem overview.
Installation
- Install and activate Kjeks first — this add-on requires it.
- Download the latest
kjeks-google.zip. - In WordPress, go to Plugins → Add New → Upload Plugin and upload the zip.
- Activate the plugin (on multisite, Network Activate it).
The plugin updates itself automatically via GitHub releases using plugin-update-checker.
How it works
Two layers keep Google inside the Kjeks consent layer (see Kjeks grilling Q7):
- Consent Mode v2 defaults are denied — before any Google code runs, the
add-on sets
ad_storage,ad_user_data,ad_personalization, andanalytics_storagetodenied. - The container is gated — the GTM/gtag container is registered with Kjeks as an inert script and only activates when the configured category is granted, so Google can never load before consent.
When the visitor changes their choice, the add-on pushes a Consent Mode
update, mapping:
| Kjeks category | Consent Mode signals |
|---|---|
analytics granted |
analytics_storage: granted |
marketing granted |
ad_storage, ad_user_data, ad_personalization: granted |
Configuration
- Network Admin → Settings → Kjeks Google — network defaults (multisite).
- Settings → Kjeks Google — per-site overrides; blank inherits the default. On a single site this is where you configure everything.
Fields: GTM container ID (GTM-XXXXXX), GA4 measurement ID (G-XXXXXXX), and
the category that must be granted before the container loads (default
analytics).
Filters
kjeks_google_config— filter the resolved{ gtm_id, ga4_id, gating_category }.
Notes and limitations
- The GTM
<noscript>iframe fallback is intentionally omitted; it would bypass the JavaScript consent gate. - Gating uses a single category. If a container mixes analytics and advertising tags, choose the stricter category or split containers.
- This add-on assists with consent wiring; it does not guarantee legal compliance.