Skip to content
WordPress Support

How to Add Google Analytics to WordPress (Step by Step)

If you cannot see how many people visit your website, where they come from, and which pages they read, you are running your site blind. This guide shows how to add Google Analytics to WordPress the reliable way — first the easy plugin method most business owners should use, then the manual method, and finally how to confirm it is actually tracking.

First, Create Your Google Analytics Property

Before touching WordPress, you need a Google Analytics account. Go to analytics.google.com, sign in with your Google account, and create a property for your website. The current version is GA4, and it gives you a Measurement ID that looks like G-XXXXXXXXXX. Keep that ID handy — it is the one piece of information WordPress needs.

For most people, a plugin is the safest option — it survives theme changes and does not require editing code:

  • In your WordPress dashboard, go to Plugins → Add New.
  • Search for a trusted analytics plugin — Google’s own Site Kit is free and official, and MonsterInsights is a popular alternative.
  • Install and activate it, then follow its setup wizard. Site Kit connects to your Google account directly and finds your property for you; other plugins ask you to paste the G-XXXXXXXXXX ID.
  • Save. That is it — tracking begins immediately.

The bonus with Site Kit is that it also shows a summary of your traffic right inside the WordPress dashboard, so you do not have to log into Analytics for a quick look — and it can connect Google Search Console at the same time, which is worth doing while you are there.

Method 2: The Manual Way (No Plugin)

If you prefer not to add a plugin, you can paste the Analytics tracking code directly into your site’s header. Google provides the snippet in the property’s Admin → Data Streams section. It needs to load on every page, inside the <head> section. Some themes have a built-in “header scripts” box for exactly this; otherwise it goes in the theme’s header.php — which is safer done through a child theme so a theme update does not wipe it out. If editing theme files makes you nervous, use Method 1 instead.

How to Check It Is Working

Do not assume it worked. Open your website in a separate browser tab, then in Google Analytics go to Reports → Realtime. You should see yourself counted as one active user within a few seconds. If you do, tracking is live. If Realtime stays empty after a few minutes, the ID is wrong, the code is not loading on every page, or a caching plugin is serving an old version — clear your cache and re-check.

Common Mistakes to Avoid

Two catch people out. First, adding the code twice — for example, both a plugin and a manual snippet — which double-counts every visit and ruins your data. Pick one method. Second, using an old Universal Analytics ID (starting UA-); those stopped collecting data in 2023, so make sure you are using a GA4 G- ID.

What to Actually Look At Once It Is Tracking

Analytics is only useful if you read it. Give it a few days to gather data, then focus on a handful of things that actually tell you something about your business:

  • How many visitors, and the trend — is traffic growing month on month? The number matters less than the direction.
  • Where they come from — Google search, social media, direct, or referrals. This tells you which of your efforts are actually bringing people in.
  • Which pages they read — your most-visited pages are your most important ones; make sure they have clear next steps and contact options.
  • Mobile vs desktop — for most Indian businesses the majority is mobile, which is a reminder to check how your site looks and loads on a phone.

Do not obsess over every metric. For a small business, “is traffic going up, where is it coming from, and what do people read” answers almost everything worth knowing. Pair Analytics with Google Search Console (which shows the search terms people used to find you) and you have the full picture, for free.

Not comfortable editing your site, or want analytics set up properly alongside Search Console and conversion tracking? Our WordPress support service handles it, and ongoing maintenance plans keep everything working. Message us on WhatsApp.

Is Your Website Working Properly?

Get a free website health check from WebMaintor. We'll review your website's speed, security, forms, and technical health — and tell you exactly what needs attention.

No obligation. No automated reports. A real review by our team.