sandywp / plugins / ga-google-analytics
GA Google Analytics
Connect Google Analytics to WordPress
Adds Google Analytics tracking code to your WordPress site. Supports many tracking features.
Ready in seconds.
v20260810 400,000+ installs WP 4.7+ PHP 5.6.20+

What you get inside
2 screens-
GA Google Analytics: Plugin Settings (default)
-
GA Google Analytics: Plugin Settings (expanded)
About this plugin
✨ Connects Google Analytics to WordPress
✨ Easily add Google Analytics 4 to your web pages
This plugin enables Google Analytics for your entire WordPress site. Lightweight and fast with plenty of great features.
🔥 Enable Google Analytics 4
Steps to enable Google Analytics 4:
- Follow this guide to create a GA4 account
- During account creation, you’ll get a tracking (measurement) ID
- Add your new tracking ID to the plugin setting, “GA Tracking ID”
- Select “GA4” for the plugin setting, “Tracking Method”
Save changes and done. Wait 24-48 hours before viewing collected data in your GA account.
🔥 GA Tracking Options
Here are the tracking methods available with this plugin:
- GA4 / Google Analytics 4 (default)
- Universal Analytics (deprecated)
- Legacy Tracking (deprecated)
Note: GA4 is recommended. Google has deprecated/disabled all other tracking options.
🔥 GA Feature Support
- Supports Google Analytics 4
- Supports Display Advertising
- Supports Enhanced Link Attribution
- Supports IP Anonymization
- Supports Force SSL
- Supports Google Optimize
- Supports Consent Signals
- Supports Tracker Objects (Universal Analytics)
- Supports User Opt-Out (Universal Analytics)
Also supports tracking links and conversions via the Custom Code setting. Learn more about Google Analytics.
🔥 General Features
- Blazing fast performance
- Does one thing and does it well
- Drop-dead simple and easy to use
- Regularly updated and “future proof”
- Stays current with the latest tracking code
- Includes tracking code in header or footer
- Includes tracking code on all WordPress web pages
- Includes option to add your own custom markup
- Sleek plugin Settings page with toggling panels
- Option to disable tracking of admin-level users
- Option to enable page tracking in the Admin Area
- Works with or without Gutenberg Block Editor
- Easy to customize the tracking code
- More features available in the Pro version »
This is a lightweight plugin that inserts the required GA tracking code. To view your site statistics, visit your Google Analytics account.
🔥 Pro Version
GA Google Analytics Pro includes the same features as the free version, PLUS the following:
- Visitor Opt-Out Box (frontend UI)
- Configure multiple tracking codes
- Live Preview of all tracking codes
- Choose location of multiple tracking codes
- Supports Custom Code in header or footer
- Disable tracking of all logged-in users
- Disable Tracking for any Post IDs, User Roles, Post Types
- Disable Tracking for Search Results and Post Archives
- Display Opt-Out Box automatically or via shortcode
- Complete Inline Help/Documentation
- Priority plugin help and support
🚀 Learn more and get GA Pro »
Privacy
User Data: This plugin does not collect any user data. Even so, the tracking code added by this plugin is used by Google to collect all sorts of user data. You can learn more about Google Privacy here.
Cookies: This plugin uses simple cookies for the visitor Opt-Out Box to remember user preference for opt-in or out of Google Analytics.
Services: This plugin does not connect to any third-party locations or services, but it does enable Google to collect all sorts of data.
GA Google Analytics is developed and maintained by Jeff Starr, 15-year WordPress developer and book author.
Support development
I develop and maintain this free plugin with love for the WordPress community. To show support, you can make a donation or purchase one of my books:
- The Tao of WordPress
- Digging into WordPress
- .htaccess made easy
- WordPress Themes In Depth
- Wizard’s SQL Recipes for WordPress
And/or purchase one of my premium WordPress plugins:
- BBQ Pro – Blazing fast WordPress firewall
- Blackhole Pro – Automatically block bad bots
- Banhammer Pro – Monitor traffic and ban the bad guys
- GA Google Analytics Pro – Connect WordPress to Google Analytics
- Head Meta Pro – Ultimate Meta Tags for WordPress
- REST Pro Tools – Awesome tools for managing the WP REST API
- Simple Ajax Chat Pro – Unlimited chat rooms
- USP Pro – Unlimited front-end forms
Links, tweets and likes also appreciated. Thank you! 🙂
Questions
- How to enable Google Analytics 4?
Check out the top of this page, first section provides the steps to add GA4 to your site.
- I am confused about all the different tracking methods?
This article should help to get a better idea of the changes: History of Google Analytics
- Tracking code is not displayed in source code?
If you check the source code of your pages and don’t see the GA tracking code, check the following:
- Check that your theme includes the hooks,
wp_headandwp_footer - If you are using a caching plugin, try clearing the cache
If the GA tracking code still is not displayed, most likely there is interference from another plugin or theme. In this case, the best way to resolve the issue is to do some basic WordPress troubleshooting.
- Check that your theme includes the hooks,
- Google Analytics says tracking code is not detected?
You need to wait 24-48 hours (or longer) for Google to collect some data. Just takes time for Googlebot to crawl your pages, collect and process data, etc. For more information, check out the Google Analytics Help Center.
- Can I filter the output of the “Custom GA Code” setting?
Yes, you can use the
gap_custom_codefilter hook.- How to implement Google Optimize?
Here are the steps:
- Enable Universal Analytics in the plugin settings
- Add the Optimize plugin (e.g.,
ga('require', 'GTM-XXXXXX');) to the setting, “Custom GA Code” - Add the Page Hiding (flicker) snippet to the setting, “Custom <head> Code”
- Enable the setting, “Custom <head> Location”
Done! You can view the source code of your web pages to verify the results.
More info about Google Optimize.
- How to enable Opt-out of tracking?
Here are the steps:
- Add the following code to the plugin setting, “Custom Code”:
<script>window['ga-disable-UA-XXXXX-Y'] = true;</script> - Check the box to enable the setting, “Custom Code Location”.
Done! You can view the source code of your web pages to verify the results.
- Add the following code to the plugin setting, “Custom Code”:
- How to disable the “auto” parameter in ga(create)?
By default the plugin includes the
autoparameter in the tracking code:ga('create', 'GA-123456789000', 'auto');However some tracking techniques (such as Site Speed Sample Rate) require replacing the
autoparameter. To do it:First disable the
autoparameter by adding the following code to WordPress functions or custom plugin:// GA Google Analytics - Disable auto parameter function ga_google_analytics_enable_auto($enable) { return false; } add_filter('ga_google_analytics_enable_auto', 'ga_google_analytics_enable_auto');Now that
autois disabled, you can replace it with your own parameter(s). For example, to implement Universal Analytics Site Speed Sample Rate, enter the following code in the plugin setting “Custom Tracker Objects”:{'siteSpeedSampleRate': 100}Save changes and done. The resulting tracking code will now look like this:
ga('create', 'GA-123456789000', {'siteSpeedSampleRate': 100});So can adjust things as needed to add any parameters that are required.
sandywp / also on the shelf
Try another plugin
Site Kit by Google – Analytics, Search Console, AdSense, Speed
4.2 · 5M+ installs
Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
-
The best free Google Analytics plugin for WordPress. See how visitors find and use your website so you can grow your business…
WP Statistics – Simple, privacy-friendly Google Analytics alternative
4.1 · 600K+ installs
Get website traffic insights with GDPR/CCPA compliant, privacy-friendly analytics. Includes visitor data, stunning graphs, and no…
Spin up a real WordPress site in seconds.
Test plugins, build a demo, hand a client a link — then squash it and start again. No local setup, no Docker.