Launch Offer2 free audits with all 229 checks. No credit card required.Start free audit

GA4 for WordPress: The Complete Setup Guide (2026)

Intermediate

What is the best way to install GA4 on WordPress?

Three installation methods for GA4 on WordPress: (1) Via GTM (Google Tag Manager plugin + GA4 configuration in GTM — recommended for sites needing Consent Mode V2 and custom events), (2) Via a dedicated GA4 plugin (Site Kit by Google, MonsterInsights — quick setup but limited custom event flexibility), (3) Manual gtag.js in theme functions.php (simple but requires developer access for all changes). The recommended method for most WordPress sites: GTM via the official Google Tag Manager plugin. GTM provides the flexibility to add Consent Mode V2, WooCommerce purchase events, and future custom events without WordPress theme edits.

Method 1 — GTM on WordPress (recommended)

Install the Google Tag Manager for WordPress plugin (by Thomas Geiger, ~2M installs) or the official Google Site Kit plugin's GTM integration.

Configuration:

  1. WordPress Admin → Plugins → Add New → search "Google Tag Manager for WordPress" → install and activate
  2. Settings → Google Tag Manager → enter your GTM container ID (GTM-XXXXXX)
  3. Enable "Track users in GTM" if using User-ID integration
  4. In GTM, create your GA4 Configuration tag and GA4 event tags as normal

Consent Mode V2 with Complianz:

Complianz (WordPress plugin) has a dedicated GTM integration. Install Complianz, configure your cookie consent settings, and enable the GTM integration. Complianz automatically handles the Consent Mode V2 default and update states via GTM's Consent Initialization trigger.

Consent Mode V2 with Cookiebot:

Install the Cookiebot plugin for WordPress. In GTM, install the Cookiebot Community Template from the Template Gallery. The template handles all Consent Mode V2 parameters automatically.

Method 2 — Dedicated GA4 plugin

Site Kit by Google

Pros: Official Google plugin, direct GA4 connection without GTM, shows basic GA4 data in WordPress dashboard.

Cons: Limited custom event support, no Consent Mode V2 (you'd need a separate CMP plugin), less flexible than GTM for advanced tracking.

Best for: Simple informational sites with basic traffic monitoring needs and no paid advertising.

MonsterInsights

Pros: User-friendly, WooCommerce e-commerce tracking built in, automatic form tracking.

Want to see which hidden implementation gaps are affecting your GA4 data quality?

Cons: Paid (from ~$99/year), Consent Mode V2 support limited in lower tiers, some events require higher-tier plans.

Best for: Non-technical WordPress admins who need e-commerce tracking without custom GTM work.

WooCommerce e-commerce tracking

For accurate WooCommerce e-commerce tracking, the recommended approach is GTM with a dataLayer integration.

Option A — Plugin-based dataLayer push:

Install "WooCommerce Google Tag Manager" plugin (or similar) that pushes WooCommerce events to the dataLayer in GA4-compatible format.

Verify by checking window.dataLayer in browser console after adding a product to cart — should show:

Option B — Custom functions.php dataLayer push:

Add custom PHP to your theme's functions.php to push WooCommerce purchase data to the dataLayer on the thank-you page:

WordPress caching problems that break GA4

Problem 1 — Caching the thank-you page If your WordPress caching plugin (WP Rocket, W3 Total Cache, LiteSpeed Cache) caches the WooCommerce thank-you/order-received page, the purchase event fires for every user who loads the cached page — even returning visitors who didn't just complete an order.

Fix: Exclude the thank-you page from caching:

  • WP Rocket: Settings → Cache → Never Cache the Following Pages → add /checkout/order-received/
  • W3 Total Cache: Performance → Page Cache → Never cache the following pages → add the order URL pattern

Problem 2 — Minification breaking the GTM snippet Aggressive JavaScript minification can break the GTM container snippet or the dataLayer push code.

Fix: Exclude GTM-related scripts from minification in your caching plugin settings.

Problem 3 — Lazy-loading the GTM script Some performance optimisation plugins move scripts to the footer or apply lazy-loading. The GTM snippet must load synchronously in <head> (for the <noscript> part in <body> too). Lazy-loading breaks Consent Mode V2 timing.

Fix: Mark GTM scripts as excluded from lazy-loading/deferral in your performance plugin.

FAQ: GA4 for WordPress: The Complete Setup Guide

What should a team validate first when ga4 for wordpress: the complete setup guide appears?

Reproduce the problem in the live implementation, isolate whether it is scoped to one report or flow, and compare it against at least one secondary source before changing the setup.

How do I know whether the fix actually worked?

You need before-and-after evidence in the browser and in the downstream report. A clean-looking dashboard without validation is not enough.

When should this become a full GA4 audit instead of a quick fix?

If the issue touches attribution, consent, revenue, campaign quality, or data trust for more than one workflow, it is usually safer to audit the surrounding implementation than patch only the visible symptom.

Run a GA4 audit before ga4 for wordpress: the complete setup guide spreads into reporting decisions

Use GA4 Audits to surface implementation gaps, broken signals, and the next fixes to prioritize before the issue becomes harder to trust or explain.

These findings come from auditing thousands of GA4 properties. See how your property compares

GA4 Audits Team

GA4 Audits Team

Analytics Engineering

Specialising in GA4 architecture, consent mode implementation, and multi-layer audit frameworks.

Share