How to Add Google Analytics 4 to WordPress: A Step-by-Step Guide

Connect Google Analytics 4 to your WordPress site with or without a plugin, check that it works, set up consent and track the actions that matter to your business.
Google Analytics 4 (GA4) shows you who visits your site, how they found you and what they do once they arrive. Adding it to WordPress takes about ten minutes. Setting it up so the numbers are accurate and useful, with consent handled and your key actions tracked, takes a little longer. This guide covers both.
Before you start
- Administrator access to your WordPress dashboard.
- A Google account you'll use for Analytics, ideally a company account rather than a personal one.
- A decision on which method to use (see the comparison in step 2). Use only one, or you'll count every visit twice.
- A cookie banner, if you have visitors in the UK, EU or other places where analytics cookies need consent.
Step 1: Create a GA4 property and web data stream
- 01Go to analytics.google.com and sign in.
- 02Open Admin and choose Create, then Property. Enter your site name, reporting time zone and currency.
- 03Add your business details and goals. These only change which reports you see first.
- 04When asked to set up a data stream, choose Web and enter your website URL.
- 05Leave Enhanced measurement switched on. It tracks page views, scrolls, outbound clicks, site search, video plays and file downloads automatically.
- 06Copy the Measurement ID. It starts with G-.
Step 2: Choose how to add the tag
| Method | Best for | Pros | Cons |
|---|---|---|---|
| Site Kit by Google | Most small business sites | Official, free, no code, shows stats in WordPress | Adds a plugin; less control over custom events |
| Google Tag Manager | Sites with several tags or custom tracking | One place for GA4, ads and other tags; flexible events | More to learn; needs careful setup |
| Manual code | Developers and lightweight sites | No extra plugin; full control | Easy to lose in theme updates if done wrong |
| Analytics plugins (e.g. MonsterInsights) | Owners who want ready-made reports | Simple setup, WooCommerce reports | Paid features; another plugin to maintain |
Option A: Site Kit by Google
Site Kit is Google's official WordPress plugin and the simplest route for most sites. It also connects Search Console, so you see search and analytics data together.
- 01In WordPress, go to Plugins, then Add New, and search for Site Kit by Google.
- 02Install and activate it, then start the setup wizard.
- 03Sign in with the same Google account and grant the requested permissions.
- 04Choose Analytics and select the property you created. Site Kit adds the tag for you.
Option B: Google Tag Manager
Tag Manager is the better choice if you also run Google Ads, Meta or LinkedIn tags, or want to track specific clicks and forms without editing code.
- 01Create an account and a Web container at tagmanager.google.com.
- 02Add the container to WordPress, either through Site Kit (it can place Tag Manager for you) or with a header-and-footer code plugin.
- 03In Tag Manager, add a Google tag with your G- Measurement ID and trigger it on Initialization – All Pages.
- 04Use Preview mode to check the tag fires, then Submit to publish the container.
Option C: Add the code manually
Copy the Google tag (gtag.js) snippet from your data stream's installation instructions and add it to your site's <head>. A code snippets plugin, or a function in a child theme that hooks into wp_head, is safer than editing your theme's header file directly, because theme updates overwrite those changes.
Step 3: Check that it works
- Open your site in another tab, then go to Reports, then Realtime, in Google Analytics. Your visit should appear within a minute or two.
- For more detail, use Google Tag Assistant (tagassistant.google.com) to connect to your site and see each event as it fires, then check Admin, then DebugView.
- View your page source and search for G- to make sure the tag appears only once.
Step 4: Set up consent mode
In the UK and EU, analytics cookies generally need the visitor's consent, and Google requires consent mode for advertising features used with visitors in the European Economic Area. Consent mode tells Google's tags whether the visitor has agreed to analytics and advertising cookies, and adjusts what they store.
- 01Install a consent management platform that supports Google consent mode. Several WordPress plugins, such as Complianz and CookieYes, do this.
- 02Set analytics and advertising storage to denied by default for visitors in regions that require consent.
- 03Check in Tag Assistant that consent updates when someone accepts or rejects cookies.
- 04Update your privacy policy to explain what you track and why.
Rules differ by country and are changing, so check current guidance from your regulator, such as the ICO in the UK, or ask a privacy professional if you're unsure.
Step 5: Track what matters to your business
Page views alone won't tell you whether your site brings customers. Mark the actions that matter as key events (Google's new name for conversions):
- Contact and quote forms. Enhanced measurement's form tracking can miss submissions, so fire an event from your form plugin or on the thank-you page instead.
- Clicks on phone numbers, email addresses and booking links.
- Purchases, if you run WooCommerce. Use an integration that sends GA4's e-commerce events, such as Site Kit's WooCommerce support or a Tag Manager setup.
- Newsletter sign-ups and file downloads such as brochures or price lists.
Then go to Admin and finish three settings that most sites miss: set data retention to 14 months instead of the default 2, define your office IP addresses as internal traffic and filter them out, and link Search Console so you can see which searches bring visitors.
Common problems and fixes
- No data in Realtime: clear your caching plugin, check the Measurement ID, and test in a private window without an ad blocker.
- Visits counted twice: the tag is installed by two methods, such as Site Kit and a theme setting. Remove one.
- Much less data than expected from UK or EU visitors: that's usually consent. Consent mode can fill some of the gap with modelled data once you have enough traffic.
- Form submissions missing: track the thank-you page or the form plugin's success event instead of relying on enhanced measurement.
- Purchases missing or duplicated: check that the order confirmation page doesn't send the purchase event again on reload.
What to look at each month
- Reports, then Acquisition, then Traffic acquisition: which channels bring visitors and key events.
- Reports, then Engagement, then Pages and screens: your most visited pages and how long people stay.
- Key events by landing page: which pages turn visitors into leads or sales.
- Search Console queries: what people searched before they arrived, and which pages to improve.
If you need a simpler view for your team, Looker Studio (free) can turn GA4 data into a one-page dashboard.
Analytics is only useful when it answers one question: which pages and channels bring customers?
Need help? Our web development team can install and test tracking on your WordPress site, our SEO team can connect it to Search Console and find quick wins, and our digital marketing team builds dashboards that show exactly what's working. Book a free consultation.
Frequently asked questions
Is Google Analytics 4 free?
Yes. The standard version of GA4 is free. Google Analytics 360, the paid version, is aimed at large companies with very high traffic and extra requirements.
Do I need a plugin to add GA4 to WordPress?
No. You can paste the Google tag into your site's head yourself or use Google Tag Manager. A plugin such as Site Kit is simply the easiest option if you don't want to touch code.
Why is Google Analytics not showing any data?
The most common causes are a caching plugin serving an old version of the page, a wrong Measurement ID, an ad blocker in your browser, or a consent banner that blocks analytics until visitors accept.
Does Google Analytics slow down WordPress?
The GA4 tag loads asynchronously, so its effect on page speed is small. Several overlapping analytics and marketing plugins have a bigger impact, so keep just one way of adding tags.
Do I need cookie consent for Google Analytics?
In the UK and EU, analytics cookies generally require consent, and other regions have their own rules. Use a consent banner with Google consent mode, and check current guidance from your regulator.


