How to Add Google Analytics to WordPress in 2025

If you own a WordPress website, tracking your visitors is essential for making informed decisions. Google Analytics is one of the most powerful tools for understanding your audience, analyzing traffic sources, and measuring your marketing efforts. Adding Google Analytics to WordPress is easier than you think. In this guide, we’ll explore three simple methods: using a plugin, adding the code manually, and integrating via Google Tag Manager.

Why Use Google Analytics on WordPress?

  • See how many people visit your site
  • Identify your most popular pages
  • Understand user behavior and engagement
  • Track conversions and sales
  • Improve your content strategy

Without analytics, you’re essentially guessing what works. With it, you can make data-driven decisions to grow your site.

Method 1: Use a Plugin (Beginner-Friendly)

The fastest and easiest way to add Google Analytics to WordPress is by using a plugin. The official Site Kit by Google is a great choice because it connects directly to your Google account.

  1. Go to your WordPress dashboard → Plugins → Add New.
  2. Search for Site Kit by Google, then install and activate it.
  3. Click Start Setup and sign in with your Google account.
  4. Allow the requested permissions and select your Analytics property.
  5. Once connected, the plugin will automatically add the tracking code.

Benefits: No coding required, easy to manage, and provides traffic reports inside WordPress.

Method 2: Add the Tracking Code Manually

If you prefer fewer plugins, you can add the Google Analytics code directly to your theme.

  1. Go to analytics.google.com and create a GA4 property.
  2. Copy the Global Site Tag (gtag.js) code.
  3. In WordPress, go to Appearance → Theme File Editor.
  4. Open the header.php file and paste the code before the </head> tag.
  5. Save changes.

Tip: Use a child theme or a header/footer script plugin to prevent losing the code during theme updates.

Method 3: Use Google Tag Manager

Google Tag Manager (GTM) is ideal if you plan to add multiple tracking scripts.

  1. Create a GTM account.
  2. Add a new tag for your GA4 Measurement ID.
  3. Copy the GTM container code.
  4. Paste it into your WordPress theme or use a header/footer plugin.
  5. Publish and verify the setup.

Verifying Your Setup

To ensure Google Analytics is working:

Final Thoughts

Whether you use a plugin, add the code manually, or set it up through Google Tag Manager, adding Google Analytics to WordPress is a must for website growth. With this tool, you’ll gain valuable insights into your audience, track performance, and make better business decisions. Start today, and watch your site’s success unfold through data.

Scroll to Top