How to Add Google Analytics 4 to WordPress: A Step-by-Step Guide

By Lee Published 25 June 2019 Updated 9 June 2026 10 min reading time
How to Add Google Analytics 4 to WordPress: A Step-by-Step Guide


If you set up tracking on your WordPress site a few years ago, the data may have stopped at some point without you noticing. Universal Analytics stopped processing new data on 1 July 2023, and Google removed access to the old reports the following year. Anything that still relies on a UA- tracking ID is no longer collecting anything.

The replacement is Google Analytics 4, or GA4. It uses a different data model, a different setup process and a different reporting layout. This guide covers creating a Google Analytics account and GA4 property, then how to add Google Analytics to WordPress with a Google Analytics plugin or with Google Tag Manager, install the tracking code, confirm the data is arriving, and read the Google Analytics reports that matter to a site owner.

What changed with GA4

GA4 measures activity as events rather than the pageview-and-session model that Universal Analytics used. A pageview, a scroll, an outbound click and a file download are all recorded as events with their own parameters. That structure lets GA4 report on engagement across a website and a mobile app under one property, which the older version could not do.

The practical difference for a WordPress site owner is the identifier. GA4 uses a Measurement ID, its Google Analytics tracking ID, in the format G-XXXXXXXXXX, not the old UA-XXXXXXX-X tracking code. If you are migrating, you cannot reuse the historical Universal Analytics data inside GA4. The two systems do not share a backend, so GA4 starts collecting from the day you connect it.

Tip: Connect GA4 as early as you can, even before your site is finished. The platform only reports on data collected after setup, so an early start gives you a longer history to compare against later.

Create a GA4 property and get your Measurement ID

Every method below needs the same thing first: a GA4 property and the Measurement ID attached to it. You create both inside the Google Analytics interface before touching WordPress.

  1. Sign in at analytics.google.com with the Google account you want to own the data.
  2. Go to Admin, then Create, then Property. Give it a name, set the reporting time zone to United Kingdom and the currency to GBP.
  3. Add your business details when prompted, then choose Web as the platform.
  4. Enter your site URL and a stream name. This creates a web data stream.
  5. On the data stream screen, copy the Measurement ID shown at the top right. It starts with G-.

Keep that ID to hand. You can return to it at any time under Admin, Data streams, then your web stream. Every connection method asks for either this ID or the Google account that holds it.

Method 1: Site Kit by Google

Site Kit, also called Google Site Kit, is Google’s own free plugin for WordPress. It connects Analytics, Google Search Console and PageSpeed Insights through one authenticated link and shows summary data inside the WordPress dashboard. For a site owner who wants the official route with the least configuration, this is the one to reach for.

Install Site Kit by Google from Plugins, Add new in your WordPress admin, then activate it. The setup wizard asks you to sign in with your Google account and verify ownership of the site. When it reaches the Analytics step, it lists the Google Analytics properties on that account so you can pick the GA4 property you created. Site Kit then inserts the Google Analytics tracking code for you, with no theme editing involved, which makes it the simplest way to connect Google Analytics to a site.

Once connected, a Google Analytics dashboard appears inside WordPress through Site Kit, with headline figures pulled from GA4 and Search Console. This Google Analytics integration links several Google services through a single login. It is a summary view rather than the full reporting suite, so you will still open Google Analytics directly for deeper analysis. If your site does not yet run WordPress, our guide to installing WordPress walks through that first.

Method 2: MonsterInsights

MonsterInsights is a third-party analytics plugin used on millions of WordPress sites. It brings GA4 reports into the WordPress dashboard in a more detailed layout than Site Kit, with a free version (the Lite tier) and paid tiers that add e-commerce, file download tracking and form tracking.

  1. Install MonsterInsights from Plugins, Add new, then activate it. A new Insights menu appears.
  2. Open the setup wizard and choose an industry category for your site.
  3. Click Connect MonsterInsights and sign in with the Google account that owns your GA4 property.
  4. Grant the requested permissions, then select your GA4 property from the dropdown. Check that it is the GA4 property and not a leftover Universal Analytics entry.
  5. Accept the recommended settings and finish the wizard.

One detail catches people out. If you created your own data stream in GA4, that stream already has Enhanced Measurement switched on. MonsterInsights also tracks the same events, so you can end up counting scrolls and downloads twice. To avoid that, open Admin, Data streams, your web stream in Google Analytics and turn Enhanced Measurement off, letting the plugin handle event tracking on its own.

Method 3: Google Tag Manager

Google Tag Manager, a tag management system, suits developers and anyone who expects to add more than one tag to a site. Rather than add Google Analytics manually by hard-coding scripts, you load a single container and manage GA4 alongside conversion tags, remarketing tags and custom events from one interface. It separates tag changes from your theme code, which matters when several tools need to fire on the same pages.

  1. Create a container at tagmanager.google.com and add its two snippets to your site. On WordPress, a connector plugin or a theme that supports header and body scripts places them for you.
  2. In the container, open Tags, New and choose the Google tag type.
  3. Paste your GA4 Measurement ID into the Tag ID field.
  4. Set the trigger to Initialisation, All Pages so the tag fires across the whole site.
  5. Use Preview mode to test, then Submit to publish the container.

Google renamed the old GA4 Configuration tag to the Google tag, and existing containers were migrated automatically, so older guides referring to a “GA4 Configuration tag” describe the same thing under its previous name.

Check your data is flowing

Whichever method you used, verify data collection in GA4 before you trust the numbers. The fastest check is the Realtime report. Open Google Analytics, go to Reports, Realtime, then load a page on your own site in another tab. Within a few seconds you should appear as an active user, which proves the tag is firing.

If you set things up through Tag Manager, run the container in Preview mode and watch GA4 DebugView at the same time. DebugView lists each event as it arrives, so you can see exactly what your site is sending. Standard reports such as Engagement take 24 to 48 hours to populate fully, so a quiet dashboard on day one is normal as long as Realtime shows activity.

The GA4 reports worth knowing

GA4 opens on a Reports snapshot that summarises recent activity. The reports below are the ones most site owners return to, and you reach them from the left navigation under Reports.

Realtime
Shows users active on the site in the last 30 minutes, with the pages they are viewing and how they arrived. Useful for confirming setup and watching the effect of a campaign as it runs.
Acquisition
Breaks down where visitors come from, such as organic search, direct, referral and social. This is where you judge which channels actually bring people to the site.
Engagement
Reports on the pages people view, how long they stay and which events they trigger. The Pages and screens view ranks your content by traffic and engagement time.
Tech and demographics
Covers the devices, browsers, countries and languages of your audience, which helps when you decide where to focus testing and design effort.

GA4 also supports conversion tracking and ecommerce tracking once you mark key events as conversions, and enhanced ecommerce tracking for online stores, which turns raw hits into a clear picture of user behaviour. Acquisition and Engagement together answer the two questions most owners care about: where traffic comes from, and what people do once they arrive. Reading them alongside your Core Web Vitals gives a fuller picture, because a fast page that nobody finds and a popular page that loads slowly are different problems with different fixes.

Common questions

A few questions come up repeatedly when people move from the old Analytics to GA4 or set it up for the first time. These cover the points that most often cause confusion during the switch.

Can I still see my Universal Analytics history?

No. Google shut down access to Universal Analytics reports during 2024, and the data behind them was deleted. GA4 cannot import that history because the two products store data in incompatible ways.

If you needed those figures for year-on-year comparison, the only option was to export them before the shutdown. Going forward, GA4 builds its own record from the point you connect it, so the sooner it is running, the sooner you have a baseline to measure against.

Which method should I choose?

There is no single best Google Analytics plugin for every site. If you want a single plugin from Google and basic stats inside WordPress, use Site Kit. If you want richer reports in the dashboard and do not mind a third-party plugin, MonsterInsights gives you more detail. If you run several marketing tags or write your own tracking, Google Tag Manager keeps everything in one container.

There is no benefit to running two methods at once. Doing so usually leads to duplicated events and inflated numbers, so pick the one that matches how technical your setup needs to be and stay with it.

Do I need to mention cookies or consent?

GA4 sets cookies and processes visitor data, so UK sites fall under PECR and UK GDPR. In practice that means a consent banner that lets visitors accept or reject analytics cookies before tracking starts.

A consent management plugin handles this for most WordPress sites, and Google’s Consent Mode can adjust what GA4 collects based on the visitor’s choice. Treat consent as part of the setup rather than an afterthought, since collecting data without it carries real compliance risk.

Further reading

Google’s own documentation is the most reliable reference for the steps that change between releases. The Analytics Help guide to setting up GA4 and the Tag Manager setup article both track the current interface.

For the wider picture of measuring and improving a WordPress site, our SEO guide explains how to act on what the reports tell you, and the SEO plugins roundup covers tools that pair well with analytics data. The guide to WordPress is a good starting point if the site itself is still new.

Wrapping up

The Google Analytics setup comes down to three steps: create the property, connect it through Site Kit, MonsterInsights or Tag Manager to install Google Analytics, and confirm the data arrives in the Realtime report. Once you have successfully installed Google Analytics, the reports take over. Once it is running, the Acquisition and Engagement reports tell you where visitors come from and what holds their attention, which is the information you act on when deciding what to work on next.

Reliable analytics depend on a site that stays online and responds quickly, since gaps in uptime show up as gaps in your data. If you are choosing where to run your site, our WordPress hosting gives GA4 a stable platform to measure.

About Lee

Lee heads Marketing, SEO, and Web Development at Unlimited Web Hosting UK, with over 17 years of industry experience.

You May Also Like

Related articles you might find interesting.

WordPress

Boost WordPress speed with caching

7 min read. 31 March 2025. Angus.
WordPress

WordPress staging sites: what they are and how to use them

6 min read. 10 September 2021. Lee.
WordPress

Elementor vs Divi: which page builder suits you?

6 min read. 15 July 2021. Lee.

Running a WordPress site?

Get fast, secure and reliable WordPress Hosting with optimised for performance with AccelerateWP.

Get WordPress Hosting

Need multiple accounts?

Create fully isolated individual accounts for your clients and manage them all from one dashboard.

Get Reseller Hosting