How to Add Google Analytics 4 to WordPress (2026 Guide)
Quick answer: Add GA4 to WordPress via the free Site Kit plugin — connect your Google account, done in 10 minutes. Manual alternative: paste the gtag.js snippet in your header. Then verify in Realtime reports and configure three settings most people skip.
Method 1: Site Kit (Recommended)
- 1. Install Site Kit by Google (free, official) from the plugin directory.
- 2. Connect your Google account — it auto-detects or creates your GA4 property.
- 3. Enable Analytics in the Site Kit dashboard — code placed automatically.
- 4. Bonus: it also connects Search Console and PageSpeed in the same flow.
Method 2: Manual Code
GA4 → Admin → Data Streams → your stream → copy the gtag.js snippet. Paste it in your theme's <head> via a child theme, a snippets plugin (WPCode), or your theme's custom code option. Works everywhere, no plugin dependency — but you manage it yourself and lose it if you switch themes without a child theme.
Verify It Works
GA4 → Reports → Realtime, then browse your own site in another tab (incognito, ad blocker off). Your visit should appear within seconds. No data after 24 hours? Check: ad blockers, caching plugins serving stale pages, wrong measurement ID, or a consent banner blocking the tag.
3 Settings to Change Immediately
- Data retention: Admin → Data Settings → Data Retention → set to 14 months (default is 2).
- Internal traffic filter: exclude your own IP or your stats get polluted by your own visits.
- Link Search Console: Admin → Product Links → connect GSC for query data inside GA4.
The GDPR Caveat
EU/UK traffic requires cookie consent before GA4 fires — add a consent plugin (Complianz, CookieYes) with Consent Mode, or skip the banner entirely with a privacy-native tool. Our GA4 vs Plausible comparison covers that trade-off, and the analytics guide puts GA4 in the full stack context. Plugin alternatives ranked in analytics plugins.
Tracking Reveals Hosting Problems
GA4's engagement metrics expose slow sites fast. Bluehost keeps pages quick enough that visitors stay — from $2.95/month.
Get Bluehost from $2.95/mo →What are you building?
Tell us about your project so we can match the perfect hosting plan.
Hosting Cost Calculator
See exactly how much you'll spend on hosting over time. Compare Bluehost vs popular alternatives and discover your potential savings.
Used to calculate transaction fees (Shopify charges 2% on sales)
Frequently Asked Questions
How do I add Google Analytics to WordPress?
Easiest: install the free Site Kit by Google plugin, connect your Google account, and it auto-places the GA4 code. Manual alternative: paste the GA4 measurement code (gtag.js) into your theme's header or via a snippets plugin. Verify data within 24 hours in GA4 Realtime.
Is Site Kit by Google free?
Yes — completely free, made by Google. It connects GA4, Search Console, AdSense, and PageSpeed Insights in one plugin with wp-admin dashboards. The official, zero-cost way to add Google Analytics to WordPress.
Where do I find my GA4 measurement ID?
In GA4: Admin → Data Streams → your web stream → the G-XXXXXXXXXX ID at top right. The full gtag.js snippet appears under 'View tag instructions'. Site Kit skips this entirely — it pulls the ID automatically during setup.
Do I need a cookie banner with GA4?
In the EU/UK, yes — GA4 uses cookies and processes personal data, so GDPR requires consent before tracking. Use a consent plugin (Complianz, CookieYes) with Consent Mode. Privacy-native alternatives like Plausible need no banner.
Why is my GA4 not showing data?
Common causes: code placed but not published, ad blockers (test in incognito), wrong measurement ID, caching plugin serving old pages, or consent banner blocking before acceptance. Check GA4 → Reports → Realtime while browsing your own site.
GA4 vs Universal Analytics — what changed?
UA was sunset in 2023; GA4 is event-based (everything is an event, not pageviews/sessions), uses engagement rate instead of bounce rate, and has a steeper learning curve. There's no upgrade path — GA4 is a fresh setup.
Ready to launch?
Get Bluehost from $3.99/month with a free domain, free SSL, and 30-day money-back guarantee.
Related Articles
Premium Domain Names in 2026: Pricing, Valuation & Buying Guide
What premium domains cost, how they're valued, where to buy them, and when a $2,000 domain beats a $12 one. The complete aftermarket guide.
What Is Domain Privacy? WHOIS Protection Explained (2026)
Domain privacy hides your name, address and email from public WHOIS lookups. Who offers it free, who charges $10/yr, and whether you actually need it.
Subdomain vs Subdirectory for SEO in 2026: The Definitive Answer
blog.example.com or example.com/blog? What Google actually says, what the data shows, and the 4 cases where a subdomain is genuinely correct.