How to add Google Analytics 4 (GA4) to WordPress?

Table of Contents

GA4 confuses people more than it should. Mostly because Google renamed everything and WordPress didn’t bother keeping up. Once you know the main ways to install it, you just pick what suits you and move on.

Below are the real, commonly used methods, step by step. No theory. Just how people actually do it.

Method 1: Using Google Site Kit (Google’s own plugin)

This is the easiest and safest option if you don’t want to touch code.

Steps:

  1. Log into WordPress

  2. Go to Plugins → Add New

  3. Search Google Site Kit

  4. Install and activate

  5. Go to Site Kit → Dashboard

  6. Sign in with your Google account

  7. Select your GA4 property

  8. Finish setup

That’s it. Tracking starts automatically.

Cost?
Free. Completely. No upsells.

Why people like it:
Google maintains it. Updates don’t usually break things.

Why some people don’t:
It adds a bit of bloat and extra menus. Nothing terrible, just clutter.

Method 2: Adding GA4 via header.php (manual, no plugin)

This is the old-school way. Clean and direct. Works on most classic themes.

Steps:

  1. Go to Google Analytics

  2. Copy the full GA4 tracking script (not just the G-ID)

  3. Log into WordPress

  4. Go to Appearance → Theme File Editor

  5. Open header.php

  6. Paste the script just before </head>

  7. Click Update File

Done.

Cost?
Free.

Important reality check:
If you change themes later, the tracking disappears. People forget this all the time and wonder why traffic drops to zero.

Method 3: Using “Insert Headers and Footers” plugin

This is for people who want manual control but don’t want to edit theme files.

Steps:

  1. Go to Plugins → Add New

  2. Search Insert Headers and Footers

  3. Install and activate

  4. Go to Settings → Insert Headers and Footers

  5. Paste the GA4 script into Header section

  6. Save

Tracking works site-wide.

Cost?
Free. Paid version exists, but you don’t need it for this.

Why this works well:
Theme changes won’t remove your code.

Method 4: Using a performance / cache plugin (WP Rocket, etc.)

Many paid performance plugins include GA integration.

Steps (example flow):

  1. Open your cache or performance plugin

  2. Go to Analytics / Tracking / Integrations

  3. Paste your G-ID

  4. Save and clear cache

Cost?
The plugin usually costs €40–€60 per year. Analytics part itself is still free.

Good if:
You already use one of these plugins anyway.

Method 5: Full Site Editing (block themes)

Block themes don’t really use header.php the same way. This trips people up.

Steps:

  1. Go to Appearance → Editor

  2. Open Templates or Template Parts

  3. Open Header

  4. Add a Custom HTML block

  5. Paste the GA4 tracking script

  6. Save

This works, but it’s easier to mess up if you’re clicking too fast.

Cost?
Free.

Quick things people in Ireland usually get wrong

• They paste only the G-ID, not the script
• They install two plugins and double-track
• They forget to clear cache
• They check Analytics after five minutes and think it’s broken

GA4 can take a few hours to show data. Sometimes a full day. That’s normal.

What I’d actually recommend

If it’s your first time: Google Site Kit
If you want clean and simple: Insert Headers and Footers
If you’re comfortable with code and won’t change themes: header.php

GA4 isn’t hard. It’s just badly explained everywhere. Once it’s installed, leave it alone and let it collect data quietly in the background. That’s when it actually becomes useful.

Facebook
Twitter
LinkedIn
Pinterest

Interested in website maintenance for your company.?We can help. 

RECENT FAQs