Descripción
WP Global Site Tag adds Google’s current site-tagging code through WordPress APIs. Configure one primary identifier and the plugin selects the correct integration:
GT-,G-,AW-, andDC-identifiers load gtag.js.GTM-identifiers load the official Google Tag Manager head snippet and body fallback.- Existing legacy
UA-tracking IDs remain visible and continue rendering after an update, including when Google routes the installed tag to a connected GA4 destination. - Additional Google tag destinations can be entered one per line.
- Fresh installations can start Google Consent Mode v2 storage states as denied.
- Existing trusted custom gtag commands remain supported for backward compatibility.
Settings are available under Settings > WP Global Site Tag.
Consent and privacy
Consent Mode is not a consent banner. You still need a consent management platform or your own consent interface to collect a visitor’s choice and update Google’s consent state.
When Consent Mode defaults are enabled, this plugin still loads gtag.js. Google may receive consent-state and cookieless requests before consent is granted. If your requirements prohibit loading Google before consent, use the wp_global_site_tag_should_render filter to prevent output until your consent system allows it.
When using a GTM container, configure consent initialization and defaults inside Google Tag Manager. The plugin’s Consent Mode setting applies only to gtag.js output.
External service
This plugin connects visitors’ browsers to Google when a valid tag or container ID is configured. gtag.js uses https://www.googletagmanager.com/gtag/js. Google Tag Manager uses https://www.googletagmanager.com/gtm.js and the no-script fallback at https://www.googletagmanager.com/ns.html.
These requests disclose standard web request information such as the visitor’s IP address, browser details, and referring page to Google. Configured Google products may send additional measurement or advertising events. What is collected depends on your Google configuration and consent implementation.
Review Google’s Privacy Policy, Terms of Service, and Google tag documentation.
Instalación
- Upload the
wp-global-site-tagfolder to/wp-content/plugins/, or install the plugin through WordPress. - Activate WP Global Site Tag.
- Open Settings > WP Global Site Tag.
- Enter a valid Google tag or Google Tag Manager identifier and save.
- Verify the tag with Google’s Tag Assistant and confirm that your consent workflow behaves as required.
Preguntas frecuentes
-
Which identifiers are supported?
-
The structured fields support
GT-,G-,AW-,DC-, andGTM-identifiers. Existing legacyUA-tracking IDs remain visible and continue rendering so plugin updates do not break a connected GA4 destination. Confirm current collection in GA4 Realtime before replacing a legacy identifier. A GTM container must be the primary identifier and cannot be added as an additional destination. -
Can I configure more than one Google destination?
-
Yes. Use a non-GTM primary identifier, then enter additional
GT-,G-,AW-, orDC-identifiers one per line. -
Does enabling Consent Mode block Google until consent?
-
No. It queues denied defaults before Google tag configuration, but gtag.js is still requested. Connect a consent management platform that calls
gtag('consent', 'update', ...), or prevent rendering with the provided filter until loading is allowed. -
Why can I not edit custom JavaScript?
-
Only trusted administrators with the
unfiltered_htmlcapability can edit that backward-compatibility field. Use structured destination fields where possible. -
How do I prevent tag output for selected requests?
-
Return
falsefrom thewp_global_site_tag_should_renderfilter. The filter receives the current decision, normalized identifier, and normalized plugin options.
Reseñas
Colaboradores y desarrolladores
Este software es de código abierto. Las siguientes personas han contribuido a este plugin.
ColaboradoresTraduce “WP Global Site Tag” a tu idioma.
¿Interesado en el desarrollo?
Revisa el código, echa un vistazo al repositorio SVN o suscríbete al registro de desarrollo por RSS.
Registro de cambios
1.1.1
- Preserved legacy
UA-tracking IDs during upgrades and added guidance for connected GA4 destinations.
1.1.0
- Added correct, separate rendering for Google tags and GTM containers.
- Added structured multiple destinations and Consent Mode v2 defaults.
- Restricted custom JavaScript editing to trusted users and blocked script-tag breakout content.
- Fixed missing-option warnings, incomplete saves, duplicate configuration, escaping, accessibility, and translation issues.
- Added complete uninstall cleanup, including multisite support and an opt-out constant.
- Replaced legacy Docker, Gulp, and Webpack tooling with wp-env and smoke tests.
- Updated WordPress and PHP compatibility metadata and privacy documentation.
1.0.7
- Removed warning messages.
1.0.6
- Added MIME type metadata.
1.0.5
- Updated the settings label.
1.0.3
- Added a settings link on the Plugins screen.
- Moved the settings page under Settings.
1.0.2
- Updated compatibility metadata for WordPress 5.0.
1.0.0
- Initial release.

