In Brief
Google Analytics 4 (GA4) is free and shows you how visitors find and use your website
The easiest method uses the Site Kit plugin, but you can also use Yoast SEO or Rank Math
UK businesses must add a cookie consent banner before activating Google Analytics due to GDPR
You can verify your setup is working by checking the Real-time report in your Analytics dashboard
You have a WordPress website for your business. People visit it.
But how many? Where do they come from?
Which pages do they actually read?
Without answers to these questions, you’re making decisions about your website based on guesswork.
Google Analytics solves this problem. It’s a free tool from Google that tracks visitor activity on your website. For small businesses and sole traders, this data helps you work out what’s working, what isn’t, and where to focus your time.
This guide walks you through adding Google Analytics to your WordPress site, step by step.
Whether you prefer using a dedicated plugin, your existing SEO plugin, or adding code manually, you’ll find clear instructions below. We’ll also cover the GDPR requirements that UK businesses need to follow. By the end, you’ll have Analytics running and collecting data about your visitors.
Table of Contents
What Is Google Analytics and Why Do You Need It?
Google Analytics is a free service that monitors who visits your website and what they do when they get there. The current version is called Google Analytics 4, or GA4 for short.
For a small business, Analytics answers questions you’d otherwise never know to ask.
- How many people visited your site last month?
- Did that social media post actually send anyone to your website?
- Which of your service pages gets the most attention?
- Are visitors using their phones or computers?
This information matters because it helps you make better decisions. If you discover that 80% of your visitors arrive on mobile devices, that’s your cue to tighten up how your site looks on phones.
If one blog post brings in twice the traffic of everything else combined, you might write more on that topic.
What Information Will You See?
Once connected, Google Analytics shows you several types of data.
You’ll see visitor numbers over time, where your traffic comes from (Google searches, social media, direct visits), which pages people view most, how long they stay, and what country or city they’re in.
GA4 also tracks events automatically. These include things like scrolling, clicking external links, watching embedded videos, and downloading files. You don’t need to set these up yourself; they work straight away.
Before You Start: What You’ll Need
Setting up Google Analytics takes about 15 to 20 minutes.
It’s straightforward, but gathering a few things beforehand will make the process smoother. Before you begin, make sure you have:
A Google account. This could be a Gmail address or a Google Workspace account if you use one for business. You’ll use this to access Google Analytics.
Admin access to your WordPress site. You need to be able to install plugins or edit theme files. If you’re not sure whether you have this access, try going to Plugins in your WordPress dashboard. If you can see an “Add New” button, you’re fine.
A decision on your method. You can add Analytics using a dedicated plugin like Site Kit (easiest), through your existing SEO plugin like Yoast or Rank Math (if you already have one), or by adding code manually (more control, requires care). The plugin methods suit most small business owners. We’ll cover all approaches below.
Method 1: Using a Plugin (Recommended for Beginners)
Plugins can add the tracking code to your site automatically, which means you don’t need to edit any files. This is the safest approach if you’re not comfortable with code.
Two plugins stand out for connecting Google Analytics to WordPress:
- Site Kit by Google
- MonsterInsights
Both have free versions that work perfectly well for small businesses.
Option A: Site Kit by Google (Free)
Site Kit is Google’s official WordPress plugin. It connects Analytics along with other Google services like Search Console and PageSpeed Insights.
Here’s how to set it up:
- In your WordPress dashboard, go to Plugins then Add New
- Search for “Site Kit by Google”
- Click Install Now, then Activate
- You’ll see a setup wizard. Click Start Setup
- Sign in with your Google account when prompted
- Grant the permissions Site Kit requests (it needs these to connect properly)
- When asked about Google Analytics, tick the box to connect it
- If you already have a GA4 property, select it. If not, Site Kit can create one for you
- Complete the remaining steps and click Go to my Dashboard
Site Kit will now show basic analytics data directly in your WordPress dashboard. For detailed reports, you can click through to Google Analytics itself.
Option B: MonsterInsights (Free/Paid)
MonsterInsights is a third-party plugin that’s been around for years. Its free version covers the basics, while paid plans add features like form tracking and ecommerce reports.
- Go to Plugins then Add New in WordPress
- Search for “MonsterInsights”
- Install and activate the plugin
- Follow the setup wizard that appears
- Connect your Google account when prompted
- Select your website property or create a new one
- Choose your business category and features
- Complete the setup
MonsterInsights displays reports inside WordPress, using simpler language than the Google Analytics interface. This can be helpful if you find Google’s dashboards confusing.
Which should you choose? Site Kit is free and official, so it stays up to date with Google’s changes. MonsterInsights offers a friendlier interface and more features if you’re willing to pay.
For most small businesses starting out, Site Kit does the job well.
Option C: Using Your Existing SEO Plugin
If you already have Yoast SEO or Rank Math installed, you can add your Google Analytics tracking code through these plugins instead of installing another one.
This keeps your plugin count down and uses a tool you’re already familiar with.
With Yoast SEO: Go to Yoast SEO in your WordPress menu, then Settings. Look for the Site connections section where you can add tracking codes. Paste your GA4 Measurement ID or the full tracking code snippet.
With Rank Math: Go to Rank Math then General Settings. Click on Analytics and connect your Google account directly, or go to Edit robots.txt and use the code insertion area. Rank Math also has a dedicated Analytics module that connects to GA4 similar to Site Kit.
This method won’t give you the dashboard reports that Site Kit or MonsterInsights provide inside WordPress. You’ll need to visit Google Analytics directly to view your data.
But if you prefer fewer plugins and already check Analytics in your browser, this works perfectly well.
Method 2: Adding the Tracking Code Manually
Some website owners prefer not to add another plugin. If you’re comfortable editing files or using a code snippets plugin, you can add the Google Analytics tracking code yourself.
This method gives you more control and avoids potential plugin conflicts. However, it requires careful attention. Adding code to the wrong place can break your site’s appearance or functionality.
Finding Your Measurement ID
First, you need your GA4 Measurement ID. This is a code that looks like G-XXXXXXXXXX.
- Go to analytics.google.com and sign in
- If you don’t have an account, click Start measuring and follow the prompts to create one
- Once inside Analytics, click the gear icon (Admin) at the bottom left
- Under your property, click Data Streams
- Click on your web stream (or create one if needed)
- Your Measurement ID appears at the top right of the panel
Copy this ID. You’ll need it in a moment.
Adding the Code to Your Theme
The tracking code needs to go in your site’s header code, just before the closing </head> tag. Here are your options:
Using a code snippets plugin: Install a plugin like WPCode (formerly Insert Headers and Footers). Go to the plugin’s settings and paste the Google tag code into the header section. This is safer than editing theme files directly.
Editing your theme: If you choose this route, always use a child theme. Otherwise, your changes will disappear when the theme updates. In your child theme’s functions.php file, you can add code to insert the tracking script. Alternatively, copy header.php to your child theme and add the code there.
The tracking code itself looks like this (you’ll find it in Google Analytics under Admin, Data Streams, then View tag instructions):
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>
Replace G-XXXXXXXXXX with your actual Measurement ID.
Important: Only add the tracking code once. If you use both a plugin and manual code, you’ll record every visitor twice, which skews your data and makes reports unreliable.
GDPR and Cookie Consent
Before you activate Google Analytics, there’s one more step to do.
Google Analytics uses cookies to track visitors. Under UK GDPR and the Privacy and Electronic Communications Regulations (PECR), you need consent from visitors before setting non-essential cookies.
Analytics cookies fall into this category.
This means you must show a cookie consent banner before Google Analytics starts tracking anyone. Simply adding Analytics and hoping for the best puts you at risk of complaints and potential fines.
Do You Need Cookie Consent for Google Analytics?
Yes, in almost all cases. The Information Commissioner’s Office (ICO) has been clear on this point. Analytics cookies are not strictly necessary for your website to function, so they require consent.
Some EU guidance suggests anonymous analytics might be exempt, but the ICO’s position is clear: UK businesses should obtain consent before setting analytics cookies.
Setting up cookie consent: Several WordPress plugins handle this well.
Popular options include:
- CookieYes (free version available & we use this)
- Complianz (free version available)
- GDPR Cookie Compliance (free)
These plugins display a banner asking visitors to accept or reject cookies. Until someone accepts, Analytics won’t load. Most plugins integrate directly with Google Analytics and Site Kit, blocking the tracking code automatically until consent is given.
When setting up your cookie banner, make sure visitors can easily reject cookies without being tricked into accepting.
How to Check Google Analytics Is Working
After setup, you’ll want to confirm everything works correctly. The quickest way is using the Real-time report in Google Analytics.
- Open your website in a browser (use an incognito window if you’ve rejected cookies on your own site)
- Accept cookies if your consent banner appears
- Go to analytics.google.com
- Click Reports then Real-time
- You should see at least one active user, which is you
If nothing appears after a few minutes, check these common issues:
Cookie consent blocking tracking: Make sure you’ve accepted cookies on your site. Many consent plugins block Analytics until you do.
Wrong Measurement ID: Double-check the ID in your plugin or code matches what’s in Google Analytics.
Caching: Some caching plugins delay changes. Clear your cache and try again.
Ad blockers: Browser extensions like uBlock Origin block Google Analytics. Test in a browser without these extensions.
Manual Code: If you have edited files directly, go back and check that the code is correct and in the right location.
If you’re using Site Kit, it has a built-in connection test that flags problems automatically.
Next Steps After Setup
With Analytics running, the real work begins.
You now have access to data, but it only becomes useful when you actually look at it.
Here are the reports worth checking regularly:
Traffic acquisition: Shows where your visitors come from. Check this weekly to see if your marketing efforts are paying off.
Pages and screens: Reveals your most popular content. Use this to understand what your audience actually wants.
Tech details: Shows which devices and browsers people use. Helpful for checking your site works well on the devices your visitors actually use.
Don’t obsess over daily numbers. Traffic varies naturally, and small businesses often don’t have enough visitors for daily changes to mean much. Weekly or monthly reviews give you a clearer picture.
Alternatives to Google Analytics
Google Analytics is the most popular choice, but it’s not the only one.
If you find GA4 too complex (lots do) or have concerns about privacy and GDPR compliance, several alternatives are worth considering.
Plausible Analytics is a lightweight, privacy-focused option. It doesn’t use cookies, so you won’t need a consent banner. The interface is far simpler than GA4, showing just the essentials: visitor numbers, traffic sources, and popular pages. It costs from around £7 per month.
Fathom Analytics works similarly to Plausible. No cookies, no consent banner required, and a clean dashboard that won’t overwhelm you. Pricing starts at around £12 per month.
Matomo offers a self-hosted option if you want full control over your data. You can run it on your own server, keeping all visitor information in-house. There’s a free self-hosted version and a paid cloud option. Setup is more involved than the others.
Jetpack Stats comes built into WordPress.com sites and is available as a plugin for self-hosted WordPress. It’s simpler than GA4 and shows basic traffic data directly in your dashboard. The free version covers most small business needs.
Microsoft Clarity is completely free and offers something different: heatmaps and session recordings that show exactly how visitors interact with your pages. It works alongside Google Analytics rather than replacing it, giving you visual insights GA4 doesn’t provide.
For most small businesses, Google Analytics remains the standard choice because it’s free and connects with other Google tools. But if simplicity or privacy matters more to you, these alternatives do the job without the complexity.
Wrapping Up
Adding Google Analytics to WordPress takes less than half an hour, and the insights you gain are worth the effort.
Whether you choose Site Kit for simplicity or MonsterInsights for its dashboard, you’ll finally have real data about how people use your website.
Remember to add a cookie consent banner before activating Analytics.
Once everything’s connected, give it a week to collect data, then start exploring. The numbers you find might surprise you, and they’ll certainly help you make smarter decisions about your website and marketing.
Frequently Asked Questions
Yes, Google Analytics is completely free for most websites. There’s a paid version called Analytics 360 for large enterprises, but the standard version handles millions of pageviews and has all the features small businesses need. You won’t be charged anything for using it on your WordPress site.
Universal Analytics was the previous version of Google Analytics. Google stopped processing data for Universal Analytics in July 2023. GA4 (Google Analytics 4) is the current version and the only option for new setups. If you had Universal Analytics before, you’ll need to create a new GA4 property from scratch. Historical data from Universal Analytics doesn’t carry over.
No. Using a plugin like Site Kit, MonsterInsights, Yoast SEO, or Rank Math requires no coding at all. The setup processes guide you through everything. Manual installation does involve copying code, but even then, plugins like WPCode let you paste it into a simple text box rather than editing theme files directly.
Yes. If you already have one of these SEO plugins installed, you can add your GA4 tracking code through their settings instead of installing another plugin. You won’t get in-dashboard reports like Site Kit provides, but your tracking will work perfectly. This is a good option if you want to keep your plugin count low.
The impact is minimal. The tracking code adds a small amount of load time, but it’s asynchronous, meaning it loads alongside your content rather than blocking it. Most visitors won’t notice any difference. The benefits of understanding your traffic far outweigh this tiny performance cost.
CookieYes, Complianz, and GDPR Cookie Compliance are all solid free options. They integrate with Google Analytics and Site Kit, automatically blocking tracking until visitors consent. Complianz is particularly thorough if you serve visitors across multiple countries. Choose one that you find easy to configure.
Yes, but it requires additional setup. If you’re running WooCommerce, plugins like MonsterInsights Pro or Site Kit can enable ecommerce tracking automatically. GA4 can then show you purchase data, revenue, product performance, and shopping behaviour. The free versions of these plugins don’t include ecommerce features.
The most common cause is your cookie consent banner blocking tracking before you’ve accepted cookies yourself. Beyond that, check whether your Measurement ID is correct and that you haven’t added the tracking code twice (which causes conflicts). Browser ad blockers can also prevent the script from running. Work through these possibilities one by one to find the issue.
For most small business websites, adding Analytics directly (via plugin or code) works fine. Google Tag Manager is useful if you need to manage multiple tracking codes or want advanced control over when tags fire. Unless you have specific requirements, it adds complexity you probably don’t need right now.