6 ways to install Google Analytics on WordPress

Updated: Tuesday, March 17, 2026

Installing Google Analytics on WordPress is usually the very first step when you want to understand your traffic, measure your audience, and track conversions. The good news is that there are several ways to do it, ranging from a one-click plugin to a cleaner setup via Google Tag Manager.

In brief

We’re going to walk through how to install Google Analytics 4 (GA4) on a WordPress site, step by step, without falling into the usual traps (double tracking, bad code, data that never shows up). And most importantly: we’ll help you pick the right method for your needs!

Before you start: what you need to connect Google Analytics to WordPress

Before adding any plugin or code to your site, make sure your Google Analytics 4 (GA4) setup is clean — this will prevent 80% of problems down the line.

Create a Google Analytics account and GA4 property

We’re talking about Google Analytics here, not Google Tag Manager. ( Find out the difference between the two in this article).

In GA4, the structure is straightforward: an account (at the “organization” level), then a GA4 property (the space that receives your site’s data), and finally a web data stream.

In practice:

  • Log into Google Analytics with your Google account.
  • Go to “Admin” via the gear icon.
  • Create a Google Analytics 4 property with the appropriate name.
  • Select the right country and time zone, then confirm.

Without a GA4 property, you won’t be able to retrieve a measurement ID (G-XXXX) — and without that, there’s no way to install Google Analytics on your WordPress site.

Create a web data stream and retrieve the measurement ID (G-XXXX)

Once your Google Analytics 4 property is set up, the next step is to configure a web data stream — this is what links your WordPress site to Google Analytics.

In Admin → Data streams, create a “Web” stream, enter your site’s URL and a stream name, then confirm.

You’ll then receive a measurement ID in G-XXXXXXX format. This is the ID you’ll use in a plugin, extension, SEOPress, or Google Tag Manager to install Google Analytics on your WordPress site.

Make sure you’re tracking the right pages (and avoid double tracking)

Before moving on to the WordPress installation, take a few minutes to avoid the most common pitfall: double tracking (Google Analytics installed twice via a plugin + inline code + GTM).

Double tracking distorts your data: inflated traffic, inaccurate user counts, unreliable dashboards, and conversion data you can’t trust.

The goal: a single installation source (plugin, code, or GTM — not a combination), followed by a quick check in GA4 using the “Real Time” report across a few key pages (homepage, blog post, conversion page).

Want to install Google Analytics 4 on WordPress cleanly and avoid common mistakes?

As a freelance Google Tag Manager consultant, I can support you from start to finish: audit and diagnosis, tracking setup and implementation, monitoring and ongoing optimization. Feel free to reach out on LinkedIn or by email at to talk it through.

6 ways to install Google Analytics on WordPress

There’s no single “best” installation method. What matters is finding the right approach for your situation (skill level, requirements, tech stack, performance, GDPR, etc.). Here are 6 reliable options for installing Google Analytics on WordPress, from the simplest to the most scalable. The choice is yours!

Method 1: Site Kit by Google

Site Kit is Google’s all-in-one plugin: Search Console, Analytics, AdSense, with a fairly seamless setup. It’s listed in the official WordPress directory and lets you connect a Google account, then select your account, property, and data stream.

The steps in brief:

  • Install the Site Kit by Google plugin.
  • Connect your Google account.
  • In the setup wizard, select your GA4 property and web data stream.
  • Confirm, then verify that data is flowing in GA4 (Real Time report).

Pros and cons

  • Pros: quick setup, minimal code, beginner-friendly.
  • Cons: limited for advanced tracking (custom events, conversions, detailed e-commerce, etc.).
Site Kit by Google
Site Kit by Google

Method 2: A dedicated Google Analytics plugin

The point of a dedicated Google Analytics plugin for WordPress isn’t just to “add GA4.” It saves time on setup, avoids editing theme files, and sometimes gives you a dashboard directly inside WordPress with traffic data (sessions, users, top pages, sources, etc.).

In practice, these plugins offer two approaches: either a connection via your Google account, or a simpler mode where you enter the G-XXXX measurement ID to automatically inject the tag across all pages of your WordPress site.

This type of plugin can also be handy if you need to manage a few marketing options without going through GTM: basic exclusions, click tracking, outbound links, and some ready-made reports. It’s often the “I want it working fast and want to see my stats without opening GA4” choice.

Things to watch out for

  • Keep the plugin updated.
  • Don’t enable every feature if all you need is basic traffic data.
  • Make sure it supports GA4 tracking specifically, not just “Google Analytics” in the broadest sense.
  • Check that it doesn’t conflict with another installation — for example, code already in your theme, another plugin, or Google Tag Manager.

A few popular options:

  • MonsterInsights: widely used, focused on guided setup and a WordPress dashboard.
  • GA4WP - Analytics Dashboard for the Website: lighter, adds tracking script and can display basic stats.

Method 3: A header/footer plugin

If you want a simple approach that doesn’t require a Google suite plugin or a heavy analytics extension, a Headers/Footers plugin does the job. The concept is simple: you paste the Google tag (gtag.js) into the <head> of your WordPress site, without touching any files directly.

Headers and Footers plugin
Headers and Footers plugin

The steps in brief:

  • Install a “Headers/Footers” plugin.
  • Paste the GA4 code snippet into the “Header” section.
  • Save.

Pros and cons

  • Pros: fast, stable, non-intrusive.
  • Cons: no advanced options beyond pasting code. Also worth paying attention to GDPR compliance, particularly around consent.

Method 4: Integration via SEOPress

If your WordPress site already uses SEOPress, you can integrate Google Analytics directly through its Analytics settings — no need to add yet another plugin just for tracking.

This works well for standard metrics: page views, traffic, reports. But if you need complex events and granular tracking, Google Tag Manager gives you more flexibility.

If you’d rather hand off the technical side, I’m available as a freelance Google Tag Manager consultant: audit and diagnosis, GTM setup, GA4/Google Ads integration, consent configuration (CMP + Consent Mode v2), and ongoing monitoring to keep tracking clean as the site evolves. Feel free to book a 20-minute discovery call!

Book a discovery call

Method 5: Manual installation

This is the old-school approach : adding the GA4 code by hand, typically in header.php just before </head>, or via a wp_head hook if you’re comfortable with WordPress development. It’s effective, but comes with more risk.

Pros and cons

  • Pros: no plugins, full control.
  • Cons:
    • If you’re editing a parent theme, an update may overwrite your code.
    • A copy-paste error can break your site’s display.
    • It’s generally harder to maintain than a centralized solution.

Best practice

Document what you’ve done — otherwise, six months from now, nobody (including you) will know where that tracking code came from.

Method 6: Google Tag Manager

Once you need more serious tracking — events, conversions, campaign measurement — the cleanest approach is usually to go through Google Tag Manager and install GA4 via GTM. You can set up GTM on WordPress manually or via a plugin like GTM4WP. It’s highly scalable: everything runs through GTM, so you can add events (button clicks, scroll depth, form submissions, etc.), manage conversions, and iterate without ever touching WordPress code.

In practice:

  • Install GTM on your site using your GTM-XXXX container ID.
  • In GTM, create a Google Analytics 4 configuration tag (Google tag or GA4 config).
  • Set the trigger to “All Pages.”
  • Publish and test.
Google Tag Manager and Google Analytics
Google Tag Manager and Google Analytics

How to verify that Google Analytics is working on your WordPress site

Once the installation is done, the most important step is confirming that data is actually coming through — otherwise you risk analyzing traffic that’s incomplete or just plain wrong.

Quick check

Start simple:

  • Open your WordPress site in a new tab (use a private/incognito window if possible).
  • Browse a few pages, then switch over to GA4.
  • Open the “Real Time” report.

You should see at least one active user and events appearing (page_view, session_start, etc.). If you installed via GTM or are testing specific events, DebugView is extremely useful for seeing exactly what’s firing.

GA4 Real Time report
GA4 Real Time report

Check for duplicate tags

This is the classic trap: GA4 installed twice through a plugin, inline code in the theme, and GTM all running at the same time. The result is skewed data — artificially inflated traffic, inaccurate user counts, unreliable reports, and conversion tracking that can’t be trusted.

Audit your WordPress site and make sure only one method is the single source of truth (a plugin OR GTM OR manual installation — never more than one at a time).

Pre-analysis checklist

Before diving into your data, make sure you have a solid foundation:

  • Confirm you’re not using different tracking IDs on different pages.
  • Exclude your own internal traffic (you, your team, your agency).
  • Verify the tag is firing on all your important pages.
  • Test on mobile — some setups behave differently across devices.
  • Validate GDPR consent if you’re using a CMP and/or Consent Mode.

My recommendation

Run a quick end-to-end test: one visit → one key page → one action (button click or form submission) → check the data in GA4.

Which method should you choose?

There’s no perfect method — just the one that fits your context and needs.

Here’s a quick guide:

Easiest setup: Site Kit

The fastest way to connect a WordPress site to Google Analytics, get data flowing, and have basic visibility — without touching any code.

Stats inside WordPress: a dedicated plugin

A good fit if you want to check your numbers in the WP dashboard (without constantly switching to GA4) and your tracking needs are fairly straightforward.

Clean, scalable tracking: GTM

As soon as you’re measuring actions, conversions, and campaigns — and expect to iterate frequently — GTM is generally the most robust foundation.

Lightweight and stable: Header/Footer plugin or SEOPress

If the goal is straightforward traffic measurement with a simple, stable setup, these options do the job without adding unnecessary complexity.

Conclusion

Installing Google Analytics on WordPress isn’t complicated, but the method you choose can make a big difference to the quality of your data and ease of maintenance. If you just want to measure traffic and understand your audience, a plugin may be all you need. If you want clean, scalable, conversion-focused tracking, Google Tag Manager is usually the most solid foundation to build on.

FAQ

In Google Analytics 4, go to Admin, then Data stream, open your web data stream: you'll see the measurement ID in G-XXXXXXX format. This is the ID you enter in your plugin, extension, SEOPress or GTM tag.
Start by checking the 'Real Time' report and make sure your tag is firing on your pages. In most cases, the problem comes down to a wrong ID, a tag missing on certain pages, or a conflict between a plugin, inline code, and GTM.
In France, the CNIL has not issued a ruling on this. In practice, GA4 is often paired with a CMP to precisely control when tracking is activated (particularly with Consent Mode V2), especially if you want usable data without unnecessary risk.
Yes: Google Analytics 4 is free in its standard version, and more than sufficient for the vast majority of WordPress sites. There is a paid enterprise offering, Google Analytics 360, designed for advanced volumes and needs.

Let's talk about your tracking

A question about this article, need an audit of your setup or server-side migration? Drop me a line, I reply within 24h.