Loading tutorials…
Loading tutorials…
There are three valid ways to install GA4 on WordPress, and the "easy" one is usually the wrong one. This walks through GTM (preferred), MonsterInsights (plugin-driven), and direct gtag.js — and how to tell which fits your stack.
Who this is forWordPress site owners installing GA4 for the first time, or replacing a broken/incomplete install. Especially relevant if you plan to also run Meta Pixel, LinkedIn Insight, or Google Ads conversion tracking — those choices interact.
What you'll need
Step 1
Three valid paths: Google Tag Manager (best for multi-tool stacks), MonsterInsights (plugin-driven, easiest), direct gtag.js (lightest, least flexible). Pick ONE.
Option A — Google Tag Manager (GTM): Install GTM once. Fire GA4, Meta Pixel, LinkedIn Insight, conversion tags, and custom events all from GTM. Best for any site that runs more than just GA4. Slightly more setup overhead but pays back inside the first week.
Option B — MonsterInsights plugin (or ExactMetrics — same code base): Install the plugin, connect a Google account, GA4 fires. Adds enhanced ecommerce, file downloads, outbound links automatically. Easiest path. Worst for portability — your tracking lives inside a WordPress plugin, not in a tag manager.
Option C — direct gtag.js in functions.php or theme header: Lightest weight, no plugin dependency. Best for single-channel sites that will never run Meta Pixel or other tracking. Most fragile when you change themes.
Recommendation: Option A (GTM) for almost every site. We walk through it in steps 2-5. Steps 6-7 cover the MonsterInsights and gtag.js alternatives if Option A is overkill for your case.
Step 2
Install the GTM4WP plugin (most reliable) or paste the GTM container snippet into your theme header. Verify with Tag Assistant.
WordPress Admin → Plugins → Add New → search "GTM4WP" by Thomas Geiger. Install Now → Activate.
Settings → Google Tag Manager → paste your GTM Container ID (GTM-XXXXXXX from tagmanager.google.com).
Settings → Google Tag Manager → Container code on/off → set to "Codeless injection (recommended)." This places both the <script> in head and the <noscript> after body open, in the right places.
Save. Open your homepage in a private window. View Source. Search for "GTM-XXXXXXX" — you should see both snippets in the right positions.
Install Google Tag Assistant Chrome extension. Visit your site with Tag Assistant enabled. Confirm GTM is detected.
Step 3
In GTM, add a Google Tag (GA4) tag with your Measurement ID, fire on All Pages, publish the container.
Open tagmanager.google.com → your container → Tags → New.
Tag Configuration → "Google Tag" (the unified tag, was "GA4 Configuration").
Tag ID → paste your GA4 Measurement ID (G-XXXXXXXXXX from GA4 Admin → Data Streams → Web stream).
Trigger → All Pages.
Save the tag. Click "Submit" in the top-right of GTM → Version name "GA4 install" → Publish.
Test: open your site in a private window. Open GA4 → Reports → Realtime. You should see your visit appear within 30 seconds.
Step 4
GA4 → Admin → Data Streams → Enhanced Measurement. Toggle the events you want auto-captured. Then mark the right ones as Key Events.
GA4 → Admin → Data Streams → click your web stream.
Scroll to "Enhanced measurement." Toggle ON: page_view (default), scrolls, outbound clicks, site search, video engagement, file downloads, form interactions.
These events now fire automatically — no GTM or code changes needed.
For business-relevant events (form_submit, purchase, signup), go to GA4 → Admin → Events. Mark the relevant event(s) as "Key Event" via the toggle.
Key Events become the conversion signal for Google Ads import — see the related tutorial on connecting GA4 to Google Ads.
Step 5
GA4 → Admin → Data Streams → Configure tag settings → Define internal traffic. Add your office IP and your home IP.
GA4 → Admin → Data Streams → your web stream → Configure tag settings (gear icon at bottom).
Show all → Define internal traffic → Create.
Name the rule "Office and home." Set parameter value to "internal."
Add your IP addresses. Use whatismyipaddress.com from each location. Add range support if your IP rotates (most home ISPs).
Save. Then GA4 → Admin → Data Settings → Data Filters → confirm "Internal Traffic" filter exists and is set to Active (not Testing).
Without this, your own visits inflate your traffic and skew engagement metrics. Especially noticeable on low-traffic sites.
Step 6
If you skipped Path A: WordPress → Plugins → Add New → MonsterInsights → Install → Activate → Connect MonsterInsights to GA4.
WordPress Admin → Plugins → Add New → search "MonsterInsights" → Install Now → Activate.
Insights → Settings → Authenticate with Google Account. Walk through the OAuth flow.
Pick the GA4 property to track. MonsterInsights starts firing GA4 within minutes.
Free version covers basic tracking. PRO ($199/yr) adds enhanced e-commerce, form tracking, custom dimensions, scroll depth — all of which GTM does for free if you have GTM set up. Most owners on MonsterInsights eventually outgrow the free tier and either upgrade or migrate to GTM.
Verify in GA4 → Realtime — your test visit should appear.
Step 7
If you will only ever run GA4 — no Meta Pixel, no LinkedIn Insight, no Google Ads conversion tag — direct gtag.js works.
Get the gtag.js snippet from GA4 → Admin → Data Streams → your web stream → View tag instructions → Install manually.
Use Code Snippets plugin (or WPCode) to inject the snippet site-wide. Settings → Code Snippets → Add New → choose 'Site-wide header' → paste the gtag snippet.
Alternative: edit your theme via Appearance → Theme File Editor → header.php → paste inside the <head> tag. This breaks on theme update — use a child theme.
Verify: View Source on your homepage. You should see one <script async src="https://www.googletagmanager.com/gtag/js?id=G-..."> tag and one matching gtag('config', 'G-...') call.
GA4 → Realtime → confirm pageview within 30 seconds.
Common mistakes
Installing GA4 via two paths at once
What goes wrong: MonsterInsights + GTM + theme-header gtag = every pageview counts 2-3 times. Bounce rate, sessions, and conversions all read 50-66% wrong. Marketing decisions on top of inflated data waste real budget.
How to avoid: View Source on your homepage. Search for "G-" — you should see your Measurement ID exactly ONCE. If you see it twice, find the duplicate install and remove it.
Not filtering internal traffic
What goes wrong: On a site doing 5,000 sessions/month, the founder visiting their own site 200 times/month is 4% of traffic — and they bounce constantly during edits. Bounce rate looks 8-12% worse than reality.
How to avoid: GA4 → Admin → Data Filters → activate Internal Traffic filter with your home + office IPs.
Using MonsterInsights free + GTM later for "more tracking"
What goes wrong: You install MonsterInsights free. Later, someone tells you GTM is better. You install GTM and add a GA4 tag — but forget to deactivate MonsterInsights. Now you double-count. Repeat for every channel added later.
How to avoid: Migrating from MonsterInsights to GTM: deactivate the MonsterInsights plugin BEFORE publishing the GTM container with the GA4 tag. Verify single Measurement ID in View Source.
Skipping enhanced measurement
What goes wrong: Without enhanced measurement on, GA4 only sees pageviews. No scroll depth, no file downloads, no outbound clicks, no form interactions. The default reports look thin and you can't analyze user behavior.
How to avoid: GA4 → Admin → Data Streams → click web stream → toggle Enhanced Measurement ON. Enable all sub-events.
Pasting GTM snippet into header.php directly
What goes wrong: Theme update replaces header.php. GTM snippet disappears. Tracking goes dark for 2-6 weeks until someone notices. All data in that window is lost.
How to avoid: Use the GTM4WP plugin, or a child theme. Either way, theme updates leave the GTM snippet intact.
Not waiting long enough before declaring data broken
What goes wrong: GA4 has 24-48 hour processing latency on most reports. Owners install GA4, refresh the Acquisition report after 1 hour, see nothing, and assume the install is broken — then add a second tracking method, breaking things further.
How to avoid: Use GA4 → Reports → Realtime to verify install (data appears in <60 seconds). Use the Acquisition/Engagement reports only after 24 hours of data accumulation.
Recap
Done — what's next
How to install Google Tag Manager on WordPress correctly
Read the next tutorial
Hand it off
GA4 install is 1-2 hours done correctly, or 1-2 weeks of debugging when you pick the wrong path. A vetted analytics specialist sets up GA4 + GTM + enhanced events + internal-traffic filters in one afternoon — typically $80-160 total at $14-16/hr. Worth it if every downstream marketing decision depends on the data being right.
See specialist rates
GTM if you will ever run a second tracking tool (Meta Pixel, LinkedIn Insight, Hotjar, Klaviyo). MonsterInsights only if GA4 is your only tracking and you want a true zero-config experience. The crossover point is usually within 6 months — most sites end up wanting more tools.
Only if you cannot or will not use GTM. PRO ($199/yr) adds e-commerce, form tracking, custom dimensions, scroll tracking — all of which GTM does for free. If you already have GTM set up, PRO is paying for features you already have.
Acquisition reports update on a 24-48 hour delay. Realtime is real-time. If Realtime shows data, the install is working — wait 48 hours before debugging Acquisition reports.
Best path: GTM trigger on form submit (specific to your form plugin — Gravity Forms, WPForms, Contact Form 7 all have known submission event hooks). Easier path: enable Enhanced Measurement → Form interactions in GA4. Cleanest path: see the dedicated forms-tracking tutorial in this series.
Not really. GA4 requires either a plugin (admin) or theme code (admin via Theme File Editor) or GTM (admin via plugin or theme). If you're an editor without admin, you need someone with admin to do the install.
Negligibly when installed correctly via GTM (async loading, <50ms parser block). MonsterInsights adds 80-150ms because it loads additional plugin code. Direct gtag.js is lightest at 30-50ms. Modern hosting + CDN absorbs all three.
WordPress
Most WordPress GTM installs are wrong in subtle ways — snippet in the wrong position, missing <noscript> tag, or hardcoded into a theme that updates monthly. This walks through the install that actually survives.
WordPress
Meta Pixel install on WordPress is easy in one sense and treacherous in another — there are three valid paths and they don't play well together. This is the decision framework + the install + the verification that 60% of DIYers skip.
WordPress
Your forms convert — but only if your analytics know. Every WordPress form has its own quirks for firing tracking events. This walks through Gravity Forms, WPForms, and Contact Form 7 with the GA4, Meta Pixel, and Google Ads tracking that turns submissions into measurable conversions.
WordPress
WordPress is the easiest CMS to start with and the easiest to make a mess of by month 18. This is the honest framework for when DIY becomes the bottleneck and a specialist pays for themselves.