HOW TO ADD GOOGLE ANALYTICS TO WORDPRESS
Learn how to add Google Analytics to WordPress step by step. Discover plugin and manual methods, setup tips, and how to verify tracking for accurate website insights.
At Lillian Purge, we specialise in Local SEO Services and have produced a practical walkthrough on How to add Google Analytics to Wordpress? so you can easily set up and start monitoring your site's traffic and behaviour.
Tracking your website traffic and understanding how visitors use your site is crucial for improving performance. Google Analytics is a free, powerful tool that helps you measure everything from page views to conversion rates. If your website is built on WordPress, integrating Google Analytics is straightforward, whether you prefer to use a plugin or add the code manually. This guide explains both methods in simple terms and helps you choose the one best suited to your business needs.
Why Add Google Analytics to WordPress?
Adding Google Analytics to WordPress allows you to track:
How visitors find your website (search, social media, referrals, or direct traffic)
Which pages attract the most engagement
How long users stay on your site and where they drop off
What percentage of visitors complete goals such as contact forms or purchases
By understanding these patterns, you can refine your content, target your SEO more effectively, and make data-led decisions to grow your business.
Step 1: Create a Google Analytics Account
If you haven’t already, start by creating a free Google Analytics account.
Go to analytics.google.com and sign in using your Google Account.
Click Start Measuring to create a new property.
Enter your website name, URL, and time zone.
When prompted, choose Web as your data stream.
You’ll then be given a Measurement ID (starts with “G-”), which is needed to connect Analytics to your WordPress site.
This setup automatically uses Google Analytics 4 (GA4), the latest version of the platform.
Step 2: Choose How to Add Analytics to WordPress
There are two main ways to connect Google Analytics to your WordPress site:
Using a plugin (the easiest and most popular option)
Adding the tracking code manually to your website’s theme
The method you choose depends on your comfort level with editing website code.
Step 3: Add Google Analytics Using a Plugin
If you’re not familiar with coding, a plugin is the simplest option. Several reliable WordPress plugins make the process easy, including Site Kit by Google, MonsterInsights, and GA Google Analytics.
Here’s how to use Site Kit by Google, the official plugin:
Go to your WordPress dashboard.
Click Plugins > Add New.
Search for Site Kit by Google and click Install Now, then Activate.
Once activated, click Start Setup.
Sign in with your Google Account and allow access.
Site Kit will automatically connect your Google Analytics property, along with Search Console and other Google tools if you choose.
Site Kit provides a simple dashboard inside WordPress where you can view key data such as traffic, search queries, and top-performing pages without leaving your site.
Step 4: Add Google Analytics Manually (Without a Plugin)
If you prefer not to use plugins or want greater control, you can add the tracking code manually.
From your Google Analytics account, go to Admin > Data Streams > Web.
Click your data stream to view the tracking code.
Copy the Global Site Tag (gtag.js) script.
In WordPress, go to Appearance > Theme File Editor and select your theme’s header.php file.
Paste the code just before the closing </head> tag.
Click Update File to save changes.
Once done, Analytics will begin tracking visitors on your site. This method is lightweight but should be repeated if you change themes in future, as the code won’t carry over automatically.
Step 5: Verify That Tracking Works
After adding the tracking code, it’s important to check that Google Analytics is working properly.
Go back to Google Analytics.
Open the Realtime report under the “Reports” section.
Visit your website in a new browser tab.
You should see your active visit appear within a few seconds.
If the Realtime data shows your activity, the setup is successful.
Step 6: Configure Basic Settings in Google Analytics
Once tracking is live, set up key configurations to get meaningful insights:
Enable Enhanced Measurement: Automatically tracks scrolls, file downloads, and outbound clicks.
Create Conversion Events: Define actions that matter, such as contact form submissions or purchases.
Link Google Search Console: Combine SEO and traffic data to see which keywords drive results.
Exclude Internal Traffic: Filter out your own visits so your data stays accurate.
These adjustments ensure your reports reflect genuine user behaviour rather than background activity.
Step 7: Use Analytics Data to Improve SEO and Conversions
Adding Google Analytics is only the first step; using the data effectively is what drives growth.
Look at reports to answer questions like:
Which pages attract the most organic traffic?
Where do users leave your site without taking action?
Which traffic sources (Google Search, social media, referrals) generate the most sales or enquiries?
By understanding this, you can identify areas for improvement, such as updating content, improving page speed, or adjusting calls to action.
For local businesses, Analytics data can also reveal which locations or devices generate the most engagement, helping you refine your local SEO strategy.
Common Issues and Troubleshooting
Data not appearing: Check that your tracking code is installed correctly and that you’re looking at the right property in Analytics.
Duplicate tracking: If you’re using multiple plugins or themes, make sure the tracking code isn’t added twice, as this can inflate visitor numbers.
Theme updates removing the code: If you manually added the tag, reinsert it after theme updates or switch to a plugin for convenience.
Expert Advice for WordPress Users
Google Analytics is one of the most powerful tools for understanding how your website performs, and when used correctly within WordPress, it can completely transform the way you approach growth. By connecting your site properly, keeping your data clean, and using the right reporting tools, you can gain deep insights into what drives traffic and conversions. Here’s how WordPress users can get the most out of their Google Analytics setup.
Use the Site Kit Plugin for Reliable Integration
The easiest and most reliable way to connect Google Analytics with your WordPress site is by using the Site Kit plugin created by Google. Site Kit eliminates the need for manual code insertion and automatically integrates Analytics, Search Console, AdSense, and PageSpeed Insights into your WordPress dashboard. This unified setup ensures your tracking is configured correctly and remains up to date with Google’s latest updates. The plugin also prevents errors such as duplicate tags or missing code, which can lead to inaccurate reporting. For new or non-technical users, Site Kit is the simplest and safest way to link your site with GA4 and access data directly from the WordPress admin panel.
Keep Tracking Data Clean and Accurate
Maintaining clean data is critical for trustworthy insights. Many site owners unknowingly track their own activity, which can distort reports. Exclude internal traffic by filtering out your IP address or setting up internal traffic rules in GA4. You should also ensure that your staging or testing environments are not connected to your live Analytics property. This helps ensure your traffic metrics reflect only real visitors and customers, not developers or admin users. Clean data gives you a more accurate understanding of user behaviour and allows you to make better marketing and SEO decisions.
Review Reports Regularly to Track Growth
To fully understand what drives performance, make reviewing your GA4 reports a regular habit. The new event-based tracking system allows you to measure user interactions such as button clicks, video plays, and page scrolls with more precision. Check which traffic sources deliver the most engaged visitors, what content generates conversions, and where users drop off the site. Reviewing your top landing pages can also help you refine content strategy, improve site navigation, and focus your SEO efforts on the areas that deliver the strongest results.
Combine Analytics and Search Console Data
Connecting Google Analytics with Search Console gives you complete visibility into how users find your website and what happens after they arrive. While Analytics tracks user behaviour, Search Console reveals which search terms bring traffic to your pages and how your site performs in Google search results. By analysing this combined data, you can identify which keywords have high impressions but low click-through rates, allowing you to adjust meta titles and descriptions for better visibility. It also highlights which landing pages perform best in search, helping you prioritise SEO updates and content improvements.
Build Clear Dashboards with Looker Studio
Once you have your tracking in place, create easy-to-read dashboards in Looker Studio (previously known as Google Data Studio). This platform allows you to turn complex data into visual reports, combining metrics from Analytics, Search Console, and other tools. You can monitor KPIs such as organic traffic, conversions, and user engagement at a glance. Dashboards make it simple to identify trends, track campaign results, and share insights with your team or clients without the need for complicated spreadsheets.
Turn Analytics into a Strategic Growth Tool
For WordPress users, Google Analytics should be more than a reporting platform. When set up and used effectively, it becomes a strategic decision-making tool that reveals where to focus your time and resources. By using Site Kit for seamless integration, maintaining clean data, reviewing reports consistently, connecting Search Console, and visualising results in Looker Studio, you can make smarter, data-driven decisions. This approach ensures that Analytics not only measures your success but also guides you toward continuous growth and long-term results.
Summary
Adding Google Analytics to WordPress is one of the most valuable steps you can take to understand your audience and improve your site’s performance. Whether you use a plugin or install the code manually, the process is straightforward and provides powerful insights into how your website generates traffic and conversions.
For help with setup, reporting, or integrating SEO insights into your analytics, Lillian Purge can assist. We help local and national businesses use data effectively to build visibility, improve engagement, and increase leads.
We have also written in depth articles on What is Organic Traffic Google Analytics and Common mistakes when setting up Google Analytics (and how to fix them) as well as our Google Analytics Hub to give you further guidance.