Google Analytics 4 Complete Setup for WordPress: A Step-by-Step Guide

Introduction

data, analysis, business, charts, graphs, analytics, finance, marketing, growth, strategy, report, laptop, office, work,
Photo by konkapo on Pixabay

If you’ve been putting off the switch to Google Analytics 4, you’re not alone. But as of July 2024, Universal Analytics has fully stopped processing new data. That means a proper GA4 setup WordPress integration isn’t optional anymore — it’s the only way to get reliable site analytics.

This guide is written for WordPress site owners who need to get GA4 working correctly, whether you’re comfortable with plugins or prefer editing code by hand. We’ll cover two setup methods, event tracking, common mistakes, and how to verify your data is actually flowing. A bad setup isn’t just a technical annoyance — it wastes your time with unreliable data.

Let’s get you set up properly, the first time.

Google Analytics 4 dashboard displayed on a laptop screen next to a coffee cup

Understanding GA4 vs. Universal Analytics

Before you start the GA4 setup WordPress process, it helps to understand what changed. Universal Analytics used a session-based model. Each visit started a session, and everything happening inside it was tied to that session. That model worked well for a simpler web, but not for modern user behavior across devices and platforms.

GA4 uses an event-based model. Everything — page views, clicks, purchases, scrolls — is an event. There are no sessions in the traditional sense. This makes GA4 more flexible, but it also means you’re comparing apples to oranges if you try to match UA and GA4 numbers side-by-side.

The important part: Universal Analytics is gone. If you still have only a UA property running, you’re collecting no data. If you’ve installed the old UA tracking code alongside GA4, you’re creating duplication issues. A clean GA4 setup WordPress is your only path forward.

Prerequisites: What You Need Before Starting

Let’s keep this practical. Before you begin the GA4 setup WordPress process, make sure you have the following:

  • A Google account — This can be any Gmail or Google Workspace account. You’ll use it to access Google Analytics.
  • Administrative access to your WordPress site — You need to be able to install plugins or edit theme files.
  • A plan for what to track — Think about your goals. Basic page views? Form submissions? WooCommerce purchases? Knowing this ahead of time affects your event setup later.
  • Google Analytics account created — If you don’t have one, go to analytics.google.com and create a GA4 property. You only need the measurement ID (starts with G-) to begin.

That’s it. You don’t need developer credentials or paid tools to get started.

Method 1: Setting Up GA4 with a WordPress Plugin

For most WordPress users, the plugin route is the best choice. It reduces the risk of accidental code errors and handles updates automatically. Here’s how to do a clean GA4 setup WordPress using the three most popular free plugins.

Site Kit by Google

Site Kit is the official Google plugin for WordPress. It’s free, maintained by Google, and connects your site to GA4, Search Console, and other Google services from one dashboard.

Steps:

  1. Install and activate the Site Kit plugin from the WordPress repository.
  2. Connect your Google account and grant the required permissions.
  3. Select your GA4 property when prompted during setup.
  4. Site Kit automatically injects the GA4 tracking code into your site’s pages.

The main advantage here is simplicity. You don’t touch any code, and the plugin auto-updates as GA4 evolves. The downside is that Site Kit’s reporting view is basic — it’s good for quick checks, but you’ll still want to log into Google Analytics for deeper reporting.

MonsterInsights (Lite)

MonsterInsights is the most popular analytics plugin for WordPress. The free version supports GA4 out of the box and gives you a more user-friendly report dashboard inside your WordPress admin.

Steps:

  1. Install and activate MonsterInsights Lite.
  2. Run the setup wizard and connect your Google account.
  3. Select your GA4 property.
  4. The plugin adds the tracking code and provides on-screen reports.

MonsterInsights Lite includes features like enhanced link attribution and basic event tracking. The pro version adds eCommerce tracking, form tracking, and custom dimensions. If you have a WooCommerce store, MonsterInsights Pro is worth considering.

GA Google Analytics

GA Google Analytics is a lighter alternative. It only focuses on injecting the tracking code with minimal overhead.

Steps:

  1. Install and activate GA Google Analytics.
  2. Go to Settings > GA Google Analytics.
  3. Paste your GA4 measurement ID.
  4. Save changes.

This plugin is ideal if you want a lightweight solution and don’t need reports inside WordPress.

security, protection, antivirus, software, cms, wordpress, content management system, editorial staff, contents, backup,
Photo by pixelcreatures on Pixabay

Which to choose? For a basic GA4 setup WordPress, Site Kit is the safest bet because it’s official and free. MonsterInsights is better if you want in-WordPress reporting. For minimalists, GA Google Analytics works perfectly.

WordPress plugin installation screen showing Site Kit by Google with GA4 settings

Method 2: Manual GA4 Code Installation

If you prefer to avoid plugins or need more control, you can add the GA4 tracking code manually. This method is more technical but gives you full authority over how the code is deployed.

Find your measurement ID:

  1. Log into your Google Analytics account.
  2. Go to Admin > Data Streams and select your website stream.
  3. Copy the measurement ID (formatted as G-XXXXXXXXXX).

Option A: Add code to header.php (not recommended for beginners)

You can paste the GA4 global site tag directly into your theme’s header.php file, just before the closing tag. The problem? If you update your theme, the code is lost. Only do this if you’re using a child theme and know what you’re doing.

Option B: Use a code snippet plugin

This is safer. Install a plugin like Insert Headers and Footers. Then go to the plugin’s settings and paste the GA4 tracking code into the header section. Save your changes.

Manual installation gives you complete control and avoids plugin bloat. However, if Google updates the tracking code format in the future, you’ll need to update it yourself.

Configuring GA4 Events for WordPress Sites

Basic GA4 setup WordPress only tracks page views by default. To get real value, you need to track events that matter to your business.

Enhanced Measurement Events

GA4 includes enhanced measurement, which is enabled by default for each web data stream. It tracks the following automatically:

  • Page views
  • Scrolls (when a user reaches 90% of a page)
  • Outbound clicks
  • Site search (if your site has a search form)
  • Video engagement (for embedded YouTube videos)
  • File downloads

Check that enhanced measurement is turned on in your GA4 Admin > Data Streams settings. It usually is, but it’s worth verifying.

Custom Events for WordPress

For more specific tracking, you need custom events. Here are the most common ones for WordPress sites:

  • Contact form submissions: Track when users successfully submit a Gravity Forms or Contact Form 7 form. You’ll need to add a custom event via Google Tag Manager or a dedicated form tracking plugin.
  • WooCommerce events: If you run an online store, track add_to_cart, view_item, purchase, and begin_checkout. MonsterInsights Pro handles this automatically. Without it, use Google Tag Manager.
  • Link clicks: Track clicks to affiliate links, partner sites, or download links beyond what enhanced measurement covers.

Google Tag Manager (GTM) is the best tool for complex event setups. It lets you add event triggers without editing your site’s code repeatedly. If you’re new to GTM, start with simple page view and click triggers before moving to more complex setups. A good reference book on Google Tag Manager can help you build confidence with the platform.

Common Mistakes to Avoid in Your GA4 Setup

Even experienced site owners make these mistakes. Avoid them, and your data will be cleaner from day one.

  • Running both UA and GA4 code: If you migrated from Universal Analytics, make sure you’ve removed the old UA tracking code. Running both creates duplicate data and inflates your numbers.
  • Forgetting to exclude internal traffic: Your team’s visits count as real traffic unless you filter them out. Use the “internal traffic” filter in GA4 to exclude IP ranges for your office, home, and VPN.
  • Not adjusting data retention: GA4 defaults to storing user-level data for just 2 months. Change this to 14 months in Admin > Data Settings > Data Retention. If you don’t, historical analysis becomes limited.
  • Confusing measurement ID with tracking ID: Your GA4 measurement ID starts with G-. Don’t paste the old UA tracking ID (UA-xxxxxx) into GA4 fields. They aren’t compatible.

GA4 Plugin: MonsterInsights vs. Site Kit vs. ExactMetrics – Which Is Best?

Choosing the right plugin affects how easy your GA4 setup WordPress will be to manage over time. Here’s a direct comparison.

Site Kit by Google

  • Ease of setup: Excellent.
  • Free features: Comprehensive. Includes GA4, Search Console, AdSense, and PageSpeed insights.
  • Upsells: None. It’s entirely free.
  • Performance impact: Low. It runs only on admin panels.
  • Best for: Basic GA4 users who want the easiest official setup.

MonsterInsights

  • Ease of setup: Excellent.
  • Free features: Basic GA4 tracking and simple reports.
  • Upsells: Pro version offers eCommerce, form tracking, and custom dimensions.
  • Performance impact: Moderate. Adds reports to your WordPress admin.
  • Best for: eCommerce stores and users who want detailed reporting inside WordPress.

ExactMetrics

  • Ease of setup: Good.
  • Free features: Similar to MonsterInsights Lite, with basic GA4 support.
  • Upsells: Pro version, priced differently than MonsterInsights.
  • Performance impact: Moderate.
  • Best for: Users who want a MonsterInsights alternative with different pricing.

Recommendation: Most site owners should start with Site Kit. It’s free, official, and covers the basics. If you run an online store, MonsterInsights Pro is worth the investment for automated eCommerce tracking.

chrome, google chrome, android, browser, chrome android, mobile browser, google chrome, google chrome, google chrome, go
Photo by deepanker70 on Pixabay

Verifying Your GA4 Implementation is Correct

You’ve done the GA4 setup WordPress installation. Now you need to confirm it works.

Step 1: Use Google Tag Assistant

Install the Google Tag Assistant Chrome extension. Navigate to your site, open the extension, and click “Enable.” It will scan your page for GA4 tags. If it finds your measurement ID firing correctly, the setup is live.

Step 2: Check GA4 Realtime Report

In Google Analytics, go to Reports > Realtime. Open your site in a new browser tab. Within 30 seconds, you should see yourself appear as an active user in the Realtime report. If you don’t, something is wrong.

Step 3: Check for duplicate tags

Use Tag Assistant again to verify there’s only one instance of your GA4 tag firing. Two copies means you’ve got both a plugin and manual code running. That will double your page view count.

Finally, note that standard GA4 reports take 24–48 hours to populate. Don’t panic if you don’t see data in your overview reports immediately. The Realtime report is your immediate validation tool.

Google Tag Assistant extension in Chrome scanning a WordPress site for GA4 tag

Setting Up Reports and Dashboards for Actionable Data

Once you’ve confirmed a working GA4 setup WordPress, the next step is making the data useful. Without reports, you’re just collecting numbers.

Custom Reports in the Explore Section

GA4’s Explore section replaces Custom Reports from Universal Analytics. Start with these three:

  • Traffic Source Report: See where your visitors come from. Create a free-form report with source and medium as dimensions, and sessions or engaged users as metrics.
  • Landing Pages Report: Identify which pages drive the most traffic. Use landing page as a dimension and add page views or conversion rate as metrics.
  • User Engagement Report: Combine event name and session duration to understand how users interact with your content.

Good data helps you make smarter decisions. For example, if a specific landing page has high traffic but low conversion, you know where to optimize. Reliable GA4 data is also valuable when choosing web hosting — you can see how server response times correlate with bounce rates.

Final Checklist for Your GA4 Setup

Use this checklist to confirm your GA4 setup WordPress is complete and accurate:

  1. Created a GA4 property in Google Analytics.
  2. Installed GA4 code via plugin or manual method.
  3. Enabled enhanced measurement in your data stream.
  4. Set up key events (form submissions, purchases, link clicks).
  5. Excluded internal traffic using IP filters.
  6. Extended data retention to 14 months.
  7. Verified code fires using Tag Assistant.
  8. Confirmed data appears in Realtime reports.

Test everything within 24 hours of setup. Fix any issues now — debugging after weeks of bad data is frustrating.

Troubleshooting Common GA4 Data Discrepancies

Even after a correct GA4 setup WordPress, you might notice numbers that seem off. Here’s what’s likely happening.

Data mismatch between GA4 and WordPress stats:

WordPress stats plugins (like Jetpack) count every request, including bots and crawlers. GA4 filters most bot traffic by default. It’s normal for GA4 to show 10–30% fewer visitors than server-side stats. This isn’t a bug — it’s a difference in methodology.

Missing events or low event count:

Ad blockers, privacy-focused browsers (like Firefox), and some security plugins can block GA4 tracking code. That’s beyond your control. But if events are missing for your own unconcealed visits, check for JavaScript errors. Open your browser’s console and reload your site. Errors there can prevent the GA4 tag from executing.

GA4 shows zero users despite traffic:

Check that you didn’t accidentally exclude your own IP too aggressively. Also ensure your measurement ID is correct — using an old UA ID in GA4 fields will produce no data.

If data still looks wrong after 48 hours, run Tag Assistant again. Sometimes a caching plugin is serving an older version of your page without the new tag. Clear your cache and retest. For site owners using a caching solution, adding a guide to WordPress caching to your reference library can help avoid common pitfalls.

Similar Posts