If you want to know where your visitors come from, which pages they read and what they do next, you need to learn how to add Google Analytics to WordPress. Without it, you are running your website blind. You can write great articles and still have no idea which ones bring people in.
The good news is that the setup is free and takes about 15 minutes. You do not need to know how to code. In this guide, you will learn four easy ways to connect Google Analytics 4 (GA4) to your WordPress site, how to check that it works, and which settings to change right after.
This guide is written for beginners, small business owners and bloggers. Pick the method that suits you, follow the steps in order and you will have working data on your dashboard today.
What Is Google Analytics and Why Does Your Website Need It?
Google Analytics is a free tool from Google that shows you what happens on your website. It counts visitors and tells you where they came from, which pages they opened, how long they stayed and which device they used.
The current version is Google Analytics 4, usually called GA4. The older version, Universal Analytics, stopped processing data in 2023, so every new setup now uses GA4.
Here is what you can learn with it:
- Traffic sources: Do people find you through Google search, social media, direct visits or other websites?
- Top pages: Which articles and service pages get the most views?
- Visitor location and device: Are most people on mobile? Which cities or countries do they come from?
- User actions: Do visitors click your contact button, fill in a form or call you?
- Growth over time: Is your traffic going up after each new article?
This is useful for any site, but it matters most when you are working on SEO. If you publish new articles and do not measure the result, you cannot tell what is working. Our guide on how to get website traffic explains how to bring visitors in. Analytics shows you whether it actually worked.
What You Need Before You Start
Get these ready first, so the setup runs smoothly:
- A Google account. Use the account you want to own your data. A business Gmail is better than a personal one you might lose.
- Admin access to your WordPress dashboard. You need it to install plugins or add code.
- Your website address. For example,
https://yourwebsite.com. Use the exact version of your site, with or without www, that you actually use. - Five to fifteen minutes. That is all it takes.
If you have not added your site to Google Search Console yet, do that too. It is a separate free tool that works together with Analytics. We explain the full process in our guide on how to add a website to Google Search Console.
Step 1: Create a Google Analytics Account and Property
Before you add anything to WordPress, you need a Google Analytics account and a GA4 property. A property is simply the home for one website’s data. Follow these steps:
- Go to Google Analytics and sign in with your Google account.
- Click Start measuring (or Admin, then Create, then Account).
- Type an account name, such as your business name, and click Next.
- Type a property name, such as your website name. Choose your time zone and currency, then click Next.
- Choose your business details, such as industry and size, then click Next. Pick your business goals and click Create.
- When asked for a platform, choose Web.
- Enter your website URL and a stream name. Leave Enhanced measurement switched on. Click Create stream.
Google now shows you a Measurement ID. It looks like G-XXXXXXXXXX. Copy it and keep it handy. You will paste it into WordPress in the next step. Google explains this process in its own guide, Set up Analytics for a website, if you want to see the official steps.
Four Ways to Add Google Analytics to WordPress
There are several ways to connect your site. All of them work. The right one depends on how comfortable you are with WordPress.
| Method | Difficulty | Best for |
|---|---|---|
| Site Kit by Google | Very easy | Beginners who want an official plugin |
| Analytics plugin (such as MonsterInsights) | Easy | People who want reports inside WordPress |
| Manual code with a header plugin | Medium | Users who want fewer plugins |
| Google Tag Manager | Medium | Sites that need advanced tracking |
Choose only one method. Using two at the same time counts every visit twice and ruins your numbers. We explain this mistake again later in the guide.
Method 1: Add Google Analytics to WordPress With Site Kit
Site Kit is the official WordPress plugin from Google. It connects Analytics, Search Console and other Google tools in one place, and it is the easiest option for most beginners. You can find it on the Site Kit plugin page.
- In your WordPress dashboard, go to Plugins, then Add New Plugin.
- Search for Site Kit by Google. Click Install Now, then Activate.
- Click Start setup and sign in with the same Google account you used for Analytics.
- Give Site Kit the permissions it asks for. It will ask you to confirm that you own the site.
- Connect Search Console first when asked. Then, when Site Kit offers it, connect Analytics.
- Choose your existing GA4 account and property. Site Kit will use your web data stream.
- Click Configure Analytics. Done.
Site Kit adds the tracking code for you, so you do not need to paste the Measurement ID anywhere. It also shows simple traffic and search reports inside your WordPress dashboard.
One small warning: Site Kit is a bigger plugin than it looks, and each extra plugin can add a little weight to your site. If speed is a worry, read our guide on how to speed up a WordPress website.
Method 2: Use an Analytics Plugin Like MonsterInsights
Plugins such as MonsterInsights, Analytify and similar tools also connect GA4 to WordPress. They help you see your reports inside the WordPress dashboard and set up tracking for clicks, forms and online store sales with a few clicks.
The steps are almost the same as for Site Kit:
- Install and activate the plugin from Plugins, then Add New Plugin.
- Open the plugin’s setup wizard.
- Sign in with Google and choose your GA4 property, or paste your Measurement ID if it asks for one.
- Finish the wizard and save.
The free versions work well for simple tracking. Paid versions add extra reports, which most small sites do not need at the start. Only upgrade if you really use the extra features.
Method 3: Add Google Analytics Code Manually
If you want fewer plugins, you can paste the Google tag yourself. The safest way is to use a small header-and-footer plugin, such as WPCode, instead of editing your theme files. If you edit theme files directly, your code disappears the next time the theme updates.
First, get your tag from Google Analytics:
- In Google Analytics, click Admin, then Data streams, then your web stream.
- Click View tag instructions, then Install manually.
- Copy the whole code snippet. It starts with
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX">.
Then add it to WordPress:
- Install and activate a plugin such as WPCode.
- Go to Code Snippets, then Header & Footer.
- Paste the snippet into the Header box.
- Click Save Changes.
Make sure you copy the snippet exactly as Google gives it, with your own Measurement ID. Do not change the code. If you use Google AdSense, its code can go in the same Header box, but keep the two snippets separate and clean.
Method 4: Add Google Analytics With Google Tag Manager
Google Tag Manager is a free tool that holds all your tracking tags in one place. It is a good choice if you plan to track many things, such as form submissions, button clicks or ad conversions, without touching your site each time.
The short version is:
- Create a Tag Manager account and a web container.
- Add the Tag Manager code to your site, using a plugin or the header box.
- Inside Tag Manager, create a Google tag with your GA4 Measurement ID.
- Set it to fire on All Pages, then Submit and Publish.
This method takes a bit longer to learn. If you are just starting, use Method 1 and move to Tag Manager later when you actually need it.
How to Check That Google Analytics Is Working
After you set it up, always test it. Do not wait a week to find out something is broken.
- Open your website in a new private (incognito) window. Click a few pages.
- In Google Analytics, open Reports, then Realtime.
- You should see at least one active user within a minute or two. That is you.
If you see nothing:
- Clear your cache. If you use LiteSpeed Cache or a similar plugin, purge all caches and reload your site.
- Turn off any ad blocker or privacy extension in your browser. These can block Analytics.
- Use Google’s Tag Assistant to see whether the Google tag is on your page.
- Check that you copied the right Measurement ID, which starts with
G-.
Keep in mind that the Realtime report is quick, but the normal reports can take 24 to 48 hours to fill in. Do not panic if they look empty on day one.
Important Settings to Change After Setup
Adding the code is only half the job. These settings make your data cleaner and more useful.
Keep Enhanced Measurement On
Enhanced measurement tracks scrolls, outbound clicks, site search, video views and file downloads without extra code. Leave it on unless you have a reason to turn it off.
Set Data Retention to 14 Months
By default, GA4 may keep detailed event data for only two months. Go to Admin, then Data collection and modification, then Data retention, and choose 14 months. This lets you compare this year with last year.
Exclude Your Own Visits
Your own clicks can mislead you, especially on a small site. In Admin, go to Data streams, open your stream, then Configure tag settings, then Define internal traffic. Add your own IP address and create a rule, so that your visits are marked as internal and filtered out.
Mark Important Actions as Key Events
A key event (called a conversion in older versions) is an action that matters to your business, such as a form submission or a click on your phone number. Go to Admin, then Events, and mark these actions as key events. Now you can see which pages bring real enquiries, not only visits.
Link Google Analytics With Search Console
This connects what people search for with what they do on your site. In Analytics, go to Admin, then Product links, then Search Console links, and follow the steps. It is very useful for SEO, because you can see which search terms bring visitors and which landing pages perform best. If you want to understand how pages get found, see our SEO checklist for a new website.
Common Mistakes to Avoid
- Using two methods at once. For example, Site Kit and a pasted code snippet together will count every visit twice. Use only one.
- Editing theme files directly. Your code will vanish after a theme update. Use a plugin or a child theme.
- Pasting the wrong ID. The GA4 Measurement ID starts with
G-. Older IDs that start withUA-no longer work. - Forgetting to test. Always check the Realtime report right after setup.
- Ignoring privacy rules. If you have visitors from regions with strict privacy laws, you may need a consent banner. More on that below.
- Looking at the data too early. A new site has little traffic. Give it a few weeks before you draw conclusions.
Privacy and Cookie Consent
Google Analytics uses cookies and collects data about visitors. For this reason, you should mention it in your Privacy Policy and be open about what you collect. If you serve visitors in the European Union, the United Kingdom or other regions with strict rules, you may also need a cookie consent banner before tracking starts.
Make sure your Privacy Policy explains that you use Google Analytics, what it collects and how visitors can opt out. This also helps if you apply for or use Google AdSense, which expects clear privacy information on your site.
This section is general information, not legal advice. If you handle sensitive data or serve many visitors from strict regions, ask a qualified professional.
What to Do With Your Analytics Data
Once data starts coming in, do not just stare at the numbers. Use a simple monthly routine:
- Check your top pages. Which articles bring the most visitors? Write more on those topics.
- Check your traffic sources. If most visits come from Google search, keep investing in SEO. If social media sends more, share more there.
- Look at low-performing pages. Pages with many visits but few clicks or actions may need better titles or clearer buttons.
- Watch the mobile share. If most visitors are on phones, make sure your pages load quickly and look good on small screens.
- Track each new article. After you publish, see how many visits it gets in 30 days.
These small checks turn raw numbers into real decisions. A small business does not need a complicated report. A simple monthly look at top pages and traffic sources already tells you where to put your time.
Frequently Asked Questions
Is Google Analytics free?
Do I need a plugin to add Google Analytics to WordPress?
How long does it take for data to show up?
Can I use Site Kit and a manual code snippet together?
Does Google Analytics slow down my website?
Is Google Analytics the same as Google Search Console?
Conclusion
Now you know how to add Google Analytics to WordPress in four simple ways. For most beginners, the Site Kit plugin is the fastest and safest choice. Create your GA4 property, connect it, test it in the Realtime report and then adjust a few key settings, such as data retention, internal traffic and key events.
The real value starts after setup. Check your numbers each month, find the pages that bring visitors and write more of what works. If you would like expert help with tracking, content and growth, you can read about our SEO services or explore affordable SEO packages for small businesses. For a wider view of what we offer, see our digital marketing services in Pakistan.
Have a question about your own setup? Contact us and we will help you get it working.

