Running a website without analytics is like running a shop with the lights off — customers come and go, and you never learn why. If you want to add Google Analytics to WordPress the right way in 2026, you have two solid options: the official Site Kit plugin, or pasting the GA4 tracking code manually. Both work, and both take under 30 minutes. This guide walks you through each one, helps you pick the right fit, and shows you how to verify tracking is actually working before you call it done.
Why GA4 (and Only GA4) in 2026
Google’s old analytics platform, Universal Analytics, stopped collecting data back in 2023. The current platform is Google Analytics 4 (GA4), and it’s built on a completely different model: everything is an event — page views, scrolls, outbound clicks, file downloads, video plays, even site searches. You no longer need to configure goals to track basic engagement the way you once did; GA4’s Enhanced Measurement switches most of it on by default.
What this means for you: install it once, and you immediately get visitor counts, traffic sources, top pages, device breakdowns, and those automatic events — all without writing a single line of code. The rest of this guide is about getting that one installation right.
Method 1: Add Google Analytics to WordPress with Site Kit (Recommended)
Site Kit by Google is Google’s official WordPress plugin. It connects your site to Analytics, Search Console, AdSense, and PageSpeed Insights from one dashboard, places the tracking code on every page automatically, and even shows a traffic summary right inside wp-admin. If you’re not sure which method to use, use this one.
Step 1: Create a GA4 Property
- Go to analytics.google.com and sign in with the Google account that should own the property — ideally the site owner’s account, not an agency’s. Whoever owns the account owns the historical data.
- Click Admin → Create → Property. Name it after the site, set your timezone and currency, and continue.
- Add a Web data stream: enter your site URL and give the stream a name. Google generates a Measurement ID that looks like G-XXXXXXXXXX. Copy it — you’ll need it in a moment.
Step 2: Install Site Kit
- In wp-admin, go to Plugins → Add New, search for “Site Kit by Google”, then Install Now and Activate.
- Click Start Setup in the Site Kit welcome screen.
- Sign in with the Google account that owns (or has access to) the GA4 property you just created, and approve the permissions Site Kit asks for.
- When Site Kit asks which Analytics property and data stream to connect, select the one from Step 1, then click Configure Analytics.
That’s it — Site Kit now inserts the GA4 tag into every page of your site. No theme editing, no pasted code, no header scripts box to hunt down.
Step 3: Verify the Tag Is Firing
- Open your site in an incognito/private window (this avoids logged-in admin traffic quirks).
- In the Analytics interface, go to Reports → Realtime. Within a minute or two, you should see at least one active user: you.
- For a second opinion, open Google’s Tag Assistant, enter your site URL, and connect — it will show whether the GA4 tag fired on the page.
If the Realtime report stays empty after several minutes, check that Site Kit’s Analytics module shows “Connected” under Site Kit → Settings, and that you selected the correct property — the most common cause is connecting to an old, unused property by mistake.
Method 2: Add the GA4 Tracking Code Manually (No Plugin)
If you’d rather not add another plugin — say you’re keeping the plugin count lean for performance — you can place the tag by hand. The rule is simple: never paste it directly into your parent theme’s files. A theme update replaces the whole theme folder and wipes your edit. Instead, use a child theme or a code-snippets plugin, and always back up first.
Step 1: Get the Snippet
In GA4, go to Admin → Data Streams, click your web stream, then View tag instructions → Install manually. Copy the snippet — it looks like this (with your real Measurement ID in place of G-XXXXXXXXXX):
<!-- 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>
Step 2: Place It via the wp_head Hook
The clean, update-proof way is to hook the snippet into wp_head from your child theme’s functions.php (or a snippets plugin):
<?php
add_action( 'wp_head', function () {
?>
<!-- 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
}, 1 );
The priority 1 loads it early in the head, which helps the tag capture visits even when the rest of the page is still rendering — a small but real accuracy win.
Step 3: Verify Exactly as in Method 1
Use the Realtime report and Tag Assistant checks above. The verification steps are identical regardless of installation method.
Site Kit vs Manual: Which Should You Choose?
| Site Kit | Manual tag | |
|---|---|---|
| Ease | No code at all — guided setup wizard | Requires editing PHP or a snippets plugin |
| Bonus features | Search Console, PageSpeed, and Analytics summaries inside wp-admin | None — tracking only |
| Performance cost | One more plugin (lightweight, but still code on every admin and frontend load) | Near-zero overhead — a single async script |
| Maintenance | Google maintains the tag; updates come automatically | You own the code — if Google changes the snippet format, you update it |
| Best for | Most site owners, bloggers, small businesses | Performance-obsessed builds, developers who want full control |
One hard rule applies to both: pick exactly one method. Running Site Kit and a manual snippet at the same time fires the tag twice and double-counts every visitor — the single most common Analytics setup mistake.
First Reports Worth Checking Once Data Flows
Give GA4 a day or two to accumulate data, then start here:
- Reports → Realtime — who’s on your site right now and what they’re doing.
- Reports snapshot — the high-level overview: users, views, engagement time, and trends.
- Engagement → Pages and screens — which pages actually get read. This is where your content strategy comes from.
- Acquisition reports — where visitors come from: Google Search, social, referrals, direct. Cross-reference this with your SEO setup to see which efforts pay off.
- Enhanced Measurement events (under Reports → Engagement → Events) — scrolls, outbound clicks, file downloads, and site searches, all tracked automatically.
If nothing appears in these reports after 24–48 hours, don’t panic: brand-new properties sometimes take a full day before processed data shows. The Realtime report is your ground truth for “is the tag working” — if that’s live, the rest follows.
A Quick Note on Consent and Privacy
GA4 uses cookies and IP-based measurement by default. If your site has visitors from the EU/UK, your cookie consent banner should cover Analytics cookies before the tag fires — check your consent plugin’s documentation for its GA4 or Google-consent-mode integration rather than assuming the banner alone is enough. This is a compliance detail worth getting right from day one.
Wrapping Up
Adding Google Analytics to WordPress is a one-time setup with years of payoff. Create your GA4 property, install it with Site Kit for the easy path (or paste the tag manually if you want zero plugin weight), never run both at once, and verify with the Realtime report before moving on. Once the data starts flowing, your Pages and Acquisition reports will tell you more about your content than guesswork ever could.
Want analytics, SEO, and speed handled by someone who does this daily? Get in touch — I set up GA4, Search Console, and performance tracking on WordPress sites for clients, and I’ll make sure your numbers are trustworthy from day one.