Adds the Google Analytics 4 tag (gtag.js) to a WordPress site. One settings screen holds the Measurement ID and the config switches. With "Respect cookie consent" on, a small loader waits for the visitor's consent before it loads Google's script, so Google receives nothing before consent. One file, no tables, no cron.
Download v2.2.0wp_head on every front-end page when a Measurement ID is set.cookieconsent_status cookie (allow or dismiss), polls it for 30 seconds after page load, and loads gtag only then.ws_ga_consent_given filter: return true to print the tag now, false to print nothing, null to keep the built-in behaviour.GA4 Measurement ID — the G-XXXXXXXXXX id. Empty means nothing is printed.Enhanced measurement — on by default; off adds enhanced_measurement: false to the config call.Demographics and interests — off by default; on adds allow_google_signals: true.Custom dimensions — a JSON object merged into the config call, for example {"custom_map": {"dimension1": "user_type"}}.Respect cookie consent — on by default; wait for consent as described above.The tag needs script-src https://www.googletagmanager.com and connect-src for https://www.google-analytics.com and https://analytics.google.com (plus the regional *.google-analytics.com hosts). WS Security's services list has a Google Analytics entry that adds them. With the consent loader on, the inline loader itself needs its hash in script-src; WS Security's hash collector picks it up.
Updates are self-hosted: the plugin reads its Update URI header and checks https://websqu.ad/updates/ws-ga.json. New versions show up in the standard WordPress updates screen. Deleting the plugin removes its five options.
Google Consent Mode v2 is not implemented: the plugin either loads gtag or does not. Logged-in administrators are tracked like everyone else.
ws_ga_consent_given filter; the loader builds the config call from a JSON object instead of eval().websquad — brandsquad OÜ, Estonia. Support: [email protected]