Why You Need Google Analytics 4 on Your WordPress Site
Before diving into setup, let’s take a step back. Why even bother with Google Analytics?
Google Analytics is more than just a traffic counter. It’s a powerful, free tool that helps you understand exactly how people use your website:
- Who your visitors are: age, location, device, and interests.
- How they find you: search engines, social media, referrals, or direct visits.
- What content they love: which blog posts, pages, or products keep them engaged.
- Where they leave: spotting drop-offs helps you improve navigation or fix weak spots.
- What actions they take: signing up for your email list, downloading freebies, or making purchases.
For marketing, this data is gold. With it, you can:
- Refine your strategy: double down on channels bringing in the most valuable traffic.
- Create better content: see what resonates and replicate its success.
- Track goals and conversions: measure ROI from campaigns and partnerships.
- Save time and money: stop guessing and start making informed decisions.
Without analytics, you’re flying blind. With it, you’re making choices backed by real data—whether you’re growing a blog, scaling a business, or simply trying to understand your audience better.

Step 1: Create a Google Analytics 4 Property
If you don’t already have a Google Analytics account, head to Google Analytics. Log in with your Google account and click Get Started.
- Enter an account name (this could be your business name).
- Create a property for your website (name it something clear like “My Blog – GA4”).
- Choose your reporting time zone and currency.
Google will then create your GA4 property.
Step 2: Get Your Measurement ID
In GA4, you no longer copy the old “UA-XXXXX” code. Instead, you’ll use a Measurement ID.
- Go to Admin > Data Streams > Web.
- Add your website URL.
- Once created, you’ll see a Measurement ID (looks like
G-XXXXXXX). - Click View Tag Instructions to see your GA4 code snippet.
It should look like this:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || \[\];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>
Copy the code Google provides; this will contain your own Measurement ID and you’ll need it for the next step.
Step 3: Add the Code to WordPress (Without a Plugin)
Don't add code directly to your parent theme—here’s why. There are two clean ways to add this code:
Option 1: Use a Child Theme’s functions.php
If you’re comfortable editing your theme files, you can paste this code into your child theme's functions.php file.
function my\_child\_theme\_google\_analytics() { ?>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || \[\];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>
<?php }
add\_action( 'wp\_head', 'my\_child\_theme\_google\_analytics', 10 );
Be sure to replace G-XXXXXXXXXX with your unique Measurement ID.
Option 2: Use the WordPress Site Editor (No Code Skills Needed)
If your site is block-based (WordPress 5.9+), you can insert your GA4 snippet in Appearance > Editor > Templates > Header and paste it just before the closing </head> tag.
Step 4: Verify Your Setup
- Open your site in a new tab.
- In GA4, go to Reports > Realtime.
- You should see your own visit appear within a few seconds.
For extra peace of mind, install the Google Tag Assistant Chrome extension—it confirms your tag is firing correctly.
Why Add GA4 Without a Plugin?
- Performance: no unnecessary plugin load.
- Security: fewer plugins mean fewer vulnerabilities.
- Control: you know exactly where your Analytics code lives.
Google Analytics 4 might feel like a shift, but once you’ve installed it, you’ll have powerful insights at your fingertips. Add it cleanly, test it, and you’ll be ready to make smarter, data-driven decisions for your blog or business.
Remember to make sure your tracking setup is GDPR-compliant.
Frequently Asked Questions
Do I need GA4 if I already had Universal Analytics?
Yes. Universal Analytics stopped processing data in 2023. GA4 is now the standard, and you’ll need it for ongoing tracking.
Is Google Analytics 4 free?
Yes—Google Analytics 4 is free to use. There’s a paid “GA360” version for enterprise, but most bloggers and small business owners won’t need it.
Can I use Google Tag Manager instead?
Yes. If you’re already using Google Tag Manager, you can add GA4 as a tag. For most beginners, though, adding GA4 directly is simpler.
What’s the easiest way to check if GA4 is working?
Use the Realtime report in GA4, or install the free Google Tag Assistant Chrome extension. Both will confirm whether your tag is firing.
Can I still use a plugin if I want to?
Yes—there are plugins like Site Kit by Google. But adding the tag manually keeps your site faster and more secure.