Descripción
This simple plugin adds Google Analytics 4 (GA4) to your WordPress site using your Measurement ID. Additional features include the ability to change the tracking code position, disabling display features, anonymize IP, and excluding roles from tracking.
Note: Universal Analytics (UA-) was discontinued by Google on July 1, 2023. This plugin still supports UA tracking IDs for backwards compatibility, but we recommend migrating to Google Analytics 4 (G-XXXXXXXX) for active tracking.
Features
- Performance focused with no bloat
- Extremely simple to setup
- Works with Google Analytics 4 (gtag.js) — Universal Analytics (analytics.js) still supported
- Regular updates for when GA changes in the future
- Only requires your GA tracking ID to work
- Option to put the tracking code in the header or footer
- Options to disable display features and anonymize IPs
- Options to exclude specific roles from GA tracking
- Option to use MinimalAnalytics.com’s tracking code (or MinimalAnalytics4 if using gtag.js)
- Google Consent Mode v2 support for GDPR/CCPA compliance
- Debug Mode for testing GA4 implementation
- Works with WP-Rocket’s local GA script feature
- Never any upsells
This plugin uses Google Analytics 4 (gtag.js) tracking code by default. Universal Analytics (analytics.js) is still supported for backwards compatibility. It does not include any built in reporting — to view your site statistics, visit Google Analytics after installing.
Instalación
To install this plugin:
- Download the plugin
- Upload the plugin to the wp-content/plugins directory,
- Go to “plugins” in your WordPress admin, then click activate.
- You’ll see a new option for Lightweight Google Analytics in your settings tab.
FAQ
-
How do I find my Google Analytics 4 Measurement ID?
-
In Google Analytics, go to Admin > Data Streams > select your stream > copy the Measurement ID (starts with G-).
-
What is Consent Mode and do I need it?
-
Google Consent Mode v2 helps you comply with GDPR/CCPA by denying analytics storage until users consent. Enable it if you use a cookie consent plugin and need to comply with privacy regulations.
-
How do I test if tracking is working?
-
Enable Debug Mode in the plugin settings, then go to Google Analytics > Admin > DebugView to see real-time hits from your site. Remember to disable Debug Mode when done testing.
-
Is Universal Analytics (UA-) still supported?
-
Yes, for backwards compatibility. However, Google discontinued UA on July 1, 2023, so data may no longer be processed. We recommend migrating to GA4.
Reseñas
Colaboradores y desarrolladores
«Lightweight Google Analytics» es un software de código abierto. Las siguientes personas han colaborado con este plugin.
Colaboradores«Lightweight Google Analytics» ha sido traducido a 5 idiomas locales. Gracias a los traductores por sus contribuciones.
Traduce «Lightweight Google Analytics» 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.5.0
- Added Google Consent Mode v2 support for GDPR/CCPA compliant tracking.
- Added Debug Mode toggle for GA4 testing via DebugView.
- Updated messaging to prioritize Google Analytics 4 (GA4) over deprecated Universal Analytics.
- Added admin notice warning for sites still using Universal Analytics (UA-) tracking IDs.
- Added note clarifying that IP anonymization is automatic in GA4.
- Added input sanitization and validation for tracking IDs and all settings.
- Code cleanup and optimization.
- Tested up to WordPress 6.9.
1.4.3
- Tested up to WordPress 6.5.
- Upgraded minimal analytics tracking scripts.
1.4.2
- Tested up to WordPress 6.3.
1.4.1
- PHP Error bugfix.
1.4
- Included MinimalAnalytics4 by idarek on GitHub. This allows you to use a gtag tracking code for page views & site search without loading Google’s bloated tracking library.
- Removed jQuery references in the admin for vanilla JS.
- Tested up to WordPress 6.0.
1.3
- Tested up to WordPress 5.8.
- Added link to analytics.google.com in settings page
1.2.2
- PHP Warning bug fix.
1.2.1
- Tested up to WordPress 5.7.
1.2.0
- Added the ability to use Global site tag measurement ID (gtag.js) as well as Universal Analytics tracking ID (analytics.js).
1.1.1
- Admin page tweaks and added a setup prompt at first install
1.1.0
- Added option to use MinimalAnalytics.com’s tracking code
1.0.0
- Initial Release.

