Installing Google Analytics 4 on WordPress looks like a five-minute job, and technically it is. The problems start later: duplicate tags firing twice, a theme update that silently wipes your code, forms that never show up as leads, or months of data polluted by your own visits.
This guide walks through the four reliable ways to add GA4 to WordPress, helps you pick the right one for your site, and covers the checks that separate a working install from an accurate one. You will learn how to create the property, connect it to WordPress, verify that data is flowing and configure the events that matter for your business.
If you are new to GA4 itself, our complete GA4 guide explains the reports and data model; this post focuses on the WordPress side.
Key Takeaways
- Create the GA4 property and web data stream first; you need its Measurement ID (starts with "G-").
- Use only one installation method. Two methods running together will double-count page views.
- Site Kit is easiest for small sites; Google Tag Manager is best when you need custom events and multiple tags.
- Never paste code into a parent theme's header.php; updates will remove it.
- Verify with the Realtime report and DebugView, then set up key events and internal traffic filters.
Step 1: Create your GA4 property and data stream
Before touching WordPress, set up Analytics. According to Google's setup guide, the process is:
- Sign in to Google Analytics and open Admin. Create an account if you do not have one.
- Create a property: name it, choose your reporting time zone and currency, and answer the business questions.
- Add a web data stream with your site URL and a stream name. Leave enhanced measurement switched on unless you have a reason not to.
- Copy the Measurement ID from the stream details. It begins with "G-".
Getting the time zone and currency right matters: they affect how days are split in reports and how revenue is shown.
Step 2: Choose your installation method
There are four common ways to connect GA4 to WordPress. Semrush's WordPress analytics guide covers the same options, including the built-in field on WordPress.com paid plans. Here is how they compare:
| Method | Best for | Pros | Cons |
|---|---|---|---|
| Site Kit by Google plugin | Small business sites, beginners | Official Google plugin, no code, shows Search Console and PageSpeed data in WordPress | Limited control over custom events |
| Google Tag Manager | Lead-gen, ecommerce, sites with many tags | Custom events, form tracking, ads tags and consent in one place | Learning curve; easy to misconfigure |
| Manual Google tag in child theme or header plugin | Developers, lightweight sites | No extra plugin overhead, full control | Code can be lost on theme changes; events need more code |
| WordPress.com built-in integration | WordPress.com hosted plans that include it | Paste the Measurement ID into one field | Plan-dependent; limited customisation |
Option A: Site Kit by Google
Site Kit is Google's own plugin. Its WordPress.org listing shows more than five million active installations at the time of writing, and describes it this way:
“Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.”
— WordPress.org, Site Kit by Google plugin listing
- In WordPress, go to Plugins → Add New, search for "Site Kit by Google", install and activate it.
- Start setup and sign in with the Google account that has access to your Analytics property.
- Verify site ownership and allow the requested permissions.
- Connect Analytics and select your existing GA4 property and web stream (or let Site Kit create one).
- Optionally connect Search Console and PageSpeed Insights for dashboards inside WordPress.
Option B: Google Tag Manager
If you plan to track form submissions, phone clicks, ads conversions or third-party pixels, GTM is the more scalable choice. Install the GTM container code (head and body snippets) through a header/footer plugin or your theme's hooks, then create a Google tag in GTM with your Measurement ID, triggered on all pages. Our Google Tag Manager guide covers containers, triggers and publishing in detail.
Option C: Manual code
In Analytics, the stream's "Install manually" instructions give you the Google tag snippet. Add it immediately after the opening head tag using a child theme's functions.php with the wp_head hook, or a trusted header-code plugin:
add_action( 'wp_head', function () { ?>
<!-- Paste the Google tag snippet from GA4 here -->
<?php }, 1 );
Never edit the parent theme directly; the next theme update will overwrite your changes. Back up the site before editing PHP.
Step 3: Verify data is flowing
Once installed, check that GA4 receives exactly one set of hits:
- Open your site in a private window and look at Reports → Realtime. Google notes data can take a short while to appear.
- Use Tag Assistant or GTM Preview to confirm the tag fires once per page. Two page_view events per load means two installs.
- Open Admin → DebugView to watch events in detail while in debug mode.
- View the page source and search for your "G-" ID to spot duplicate snippets left by old plugins or themes.
Step 4: Configure what matters after installation
A default install only tells you about visits. To make GA4 useful for a WordPress business site, finish these settings:
| Setting | Why it matters | Where to learn more |
|---|---|---|
| Key events (leads, purchases, bookings) | Turns traffic into business outcomes | GA4 key events |
| Form submission tracking | Most WordPress form plugins need extra setup | Track form submissions |
| Internal traffic filter | Removes your team's visits | Exclude internal traffic |
| Ecommerce events (WooCommerce) | Revenue, product and checkout reports | GA4 ecommerce tracking |
| Data retention | Controls how long user-level data is kept for explorations; review the default | Admin → Data settings |
| Search Console link | Brings query data into GA4 | See organic keywords in GA4 |
Consent and privacy
If you have visitors from the EU, UK or other regions with consent rules, load analytics in line with your consent banner. Many WordPress consent plugins support Google Consent Mode, which adjusts how Google tags behave based on the visitor's choice. Test the banner after installing GA4: accept, reject and check what fires in each case.
Common mistakes when adding GA4 to WordPress
- Double installation. Site Kit plus a manual snippet plus a theme's built-in analytics field equals inflated page views and a broken bounce/engagement picture.
- Editing the parent theme. Code disappears on the next update, often unnoticed for weeks.
- Caching plugins serving old HTML. Clear page and CDN caches after adding or removing tags.
- Tracking staging sites. Keep your staging environment out of production data; see our note on staging site SEO.
- Skipping key events. Without them, GA4 cannot tell you which pages or channels generate leads.
- Ignoring page speed. Every extra plugin and tag adds weight; review what you load with our guide to third-party scripts.
Related Guides
- Share of Search: A Leading Indicator of Market Share
- Microsoft Clarity: Free Session Recordings and Insights
- GA4 Ecommerce Tracking: Setup and Key Reports
Frequently Asked Questions
Do I need a plugin to add GA4 to WordPress?
No. You can add the Google tag manually through a child theme or use Google Tag Manager. A plugin such as Site Kit simply makes setup easier for non-developers.
Is Site Kit or Google Tag Manager better?
Site Kit suits simple sites that only need standard reporting. Google Tag Manager is better if you need form tracking, ads conversion tags or several marketing pixels.
Why is GA4 showing double page views on my WordPress site?
Usually two installation methods are active at once, such as a plugin and a manual snippet. Remove one and confirm with Tag Assistant that only one page_view fires per load.
How long until data appears in GA4?
Realtime data usually shows within minutes. Standard reports can take longer to process, so check Realtime and DebugView first.
Can I track WooCommerce sales with GA4?
Yes, but it needs ecommerce events such as purchase with item data. Use a dedicated integration or GTM data layer rather than relying on page views.
Conclusion
Adding GA4 to WordPress takes minutes, but accurate measurement takes a little more care: one installation method, verified tags, clear key events and clean filters. Get those right and every SEO, content and ads decision becomes easier. If you would like experts to set up and audit your analytics alongside a WordPress growth plan, see our SEO services or get a quote.




