Meregate.com
Thursday, November 19, 2026
Home โ€บ Data & Analytics โ€บ How to Add Google Analytics to WordPress: A Simple Step-by-Step Guide (2026)

How to Add Google Analytics to WordPress: A Simple Step-by-Step Guide (2026)

How to Add Google Analytics to WordPress: A Simple Step-by-Step Guide (2026)

Google Analytics tells you who visits your WordPress site, where they come from, and what they do once they arrive. It is free, and you can set it up in about 15 minutes. This guide shows you how to add Google Analytics to WordPress step by step, with a plugin or without one, so you can pick the method that fits you.

Last updated: November 2026

What you need before you start

You need two things before you touch your site:

  • A Google account. Any Gmail account works.
  • A Google Analytics 4 (GA4) property for your site. This is where your data lives. If you do not have one yet, create it first โ€” it takes about five minutes.

How to create a GA4 property and get your Measurement ID

  1. Go to Google Analytics and sign in with your Google account.
  2. Click Admin (the gear icon, bottom left), then Create property.
  3. Give the property a name, like your website name, pick your time zone and currency, and click Next.
  4. Answer the two short questions about your business size and goals, then click Create.
  5. Choose Web as the platform, enter your website address and a stream name, and click Create stream.
  6. Your Measurement ID appears on the stream page. It starts with G-, like G-ABC123XYZ. Copy it and keep it safe โ€” you will need it in the steps below.

If you see an ID that starts with UA-, you are looking at an old Universal Analytics property. Universal Analytics stopped collecting data in 2023, so do not use it. Make sure your property is GA4 and your ID starts with G-.

One more thing to check: this guide is for self-hosted WordPress sites (WordPress.org). If your site runs on the free WordPress.com plan, you cannot add Google Analytics โ€” that plan does not allow tracking code or plugins. You need the WordPress.com Business plan or higher, or a self-hosted site, to install it.

Which method should you use?

There are five ways to add Google Analytics to WordPress. They all track the same data. The difference is how much work they take and how much control you get. Pick one โ€” and use only one. If you add the tracking code twice, for example through a plugin and a code snippet, Google Analytics can count the same visit twice and your numbers will be wrong.

MethodBest forCode needed?
Site Kit by Google (plugin)Most beginnersNo
MonsterInsights free (plugin)Reports inside WordPressNo
WPCode (code snippet plugin)People who want no analytics pluginCopy and paste only
Google Tag ManagerSites with several tracking toolsCopy and paste only
Theme functions.phpDevelopers onlyYes

If you are not sure, use Site Kit. It is Google’s own free plugin, it takes about five minutes, and it also connects Search Console and PageSpeed Insights if you want them later.

Method 1: Add Google Analytics with Site Kit by Google (easiest)

Site Kit is Google’s official WordPress plugin. It adds the tracking code for you and shows some of your Analytics data right inside your WordPress dashboard.

  1. In your WordPress dashboard, go to Plugins > Add New.
  2. Search for Site Kit by Google, then click Install Now and Activate.
  3. Click Start Setup and sign in with the same Google account you used to create your GA4 property.
  4. Allow the permissions Site Kit asks for. It needs access so it can connect your site to your Analytics property.
  5. When Site Kit asks which property to connect, pick the GA4 property you created. If you already made a property, choose it from the list. If not, Site Kit can create one for you.
  6. Finish the setup. Site Kit adds the Google tag to every page of your site by itself.

That is it. You do not need to paste any code. Site Kit also adds a small Analytics panel to your WordPress dashboard, so you can see your top pages and traffic sources without leaving WordPress.

Method 2: Add Google Analytics with MonsterInsights (free plugin)

MonsterInsights is a popular Analytics plugin with a free version. Like Site Kit, it connects your site to Google Analytics without code and shows reports inside WordPress. The free version covers the basics โ€” visitors, top pages, and traffic sources. The paid version adds more reports and tracking options, but most small sites do fine on the free plan.

  1. In your WordPress dashboard, go to Plugins > Add New.
  2. Search for MonsterInsights, then click Install Now and Activate.
  3. The setup wizard starts. Click Launch the Wizard.
  4. Pick the category that fits your site (blog, business site, or online store) and click Save and Continue.
  5. Click Connect MonsterInsights and sign in with the Google account that owns your GA4 property.
  6. Pick your GA4 property from the list and click Complete Connection.
  7. On the next screen, skip the recommended settings you do not need, then click Save and Continue until the wizard ends.

MonsterInsights adds the tracking code to your site. You can see a simple traffic report under Insights > Reports in your WordPress dashboard.

Method 3: Add Google Analytics with WPCode (no analytics plugin)

If you do not want a dedicated analytics plugin, WPCode is a good middle ground. It is a free code-snippet plugin that pastes your Google tag into your site’s header for you. The code stays in place when you change or update your theme, which is the main risk of editing theme files by hand.

  1. In Google Analytics, open Admin > Data Streams, click your web stream, and open View tag instructions > Install manually. Copy the full Google tag code.
  2. In WordPress, go to Plugins > Add New, search for WPCode, then click Install Now and Activate.
  3. Go to Code Snippets > Header & Footer.
  4. Paste the Google tag code into the Header box.
  5. Click Save Changes.

Your site now sends data to Google Analytics. This method does not add any reports to your WordPress dashboard โ€” you check your numbers in Google Analytics itself.

A laptop and tablet showing charts and tables with website data
Source: Pexels

Method 4: Add Google Analytics with Google Tag Manager

Google Tag Manager (GTM) is a free tool that manages all your tracking code from one place. It makes sense if your site already runs other scripts โ€” an ad pixel, a chat widget, or a cookie banner โ€” because you can add and remove them all without touching your site’s code again. For a simple blog with no other tracking, it is more than you need.

  1. Create a free account at Google Tag Manager and set up a container for your website. Copy the two code snippets Tag Manager gives you.
  2. Add those snippets to your site with WPCode (paste the first snippet in the Header box and the second in the Body box), or with a Tag Manager plugin.
  3. In Tag Manager, create a new tag of the type Google Tag, paste in your Measurement ID (the G- code), and set it to fire on All Pages.
  4. Click Submit, then Publish the container.

Until you publish the container, nothing is tracked. That is the step people forget most often with this method.

Method 5: Add the code to your theme (developers only)

You can paste the Google tag straight into your theme, but do this only if you are comfortable editing code โ€” and only in a child theme. If you paste it into your main theme’s files, the next theme update will wipe it out and tracking will stop without warning.

  1. Copy the Google tag from Admin > Data Streams > View tag instructions > Install manually in Google Analytics.
  2. In WordPress, go to Appearance > Theme File Editor and open your child theme’s functions.php file.
  3. Add a small function that prints the tag in the site header, then save.

For most site owners, Method 1 or Method 3 does the same job with far less risk. There is no tracking benefit to doing it by hand.

How to check that Google Analytics is working

Do not assume the install worked. Check it the same day:

  1. Open your website in a new browser tab and visit two or three pages. Stay on each page for a few seconds.
  2. In Google Analytics, open Reports > Realtime. You should see yourself as one active user within a minute or two.
  3. If the Realtime report is empty, wait an hour and check again. New properties can take up to 48 hours before regular reports start showing data, but Realtime usually works within minutes.

If Realtime still shows nothing after a few hours, check these three things: you used only one install method, the Measurement ID matches your property, and the tag is actually on the page (open your site, right-click, choose View Page Source, and search for your G- ID).

Mistakes to avoid

  • Installing it twice. One method only. Two copies of the tag means double-counted visits.
  • Using an old UA- ID. Universal Analytics is dead. Your ID must start with G-.
  • Connecting the wrong property. If you have more than one GA4 property, double-check you picked the one for this site.
  • Expecting data right away. Realtime works fast, but full reports take up to 48 hours to fill in. An empty report on day one is normal.
  • Editing your main theme. Theme updates erase hand-added code. Use a plugin or a child theme.
  • Forgetting Tag Manager’s publish step. A container that is saved but not published tracks nothing.

What to look at first after setup

Once data starts coming in, three reports tell you most of what you need as a beginner:

  • Realtime. Who is on your site right now, and which pages they are viewing. Good for a quick check that tracking works.
  • Traffic acquisition. Where your visitors come from โ€” Google search, social media, other sites, or direct visits. This tells you which of your efforts is actually bringing people in.
  • Pages and screens. Which pages get the most views. Your most-read pages are the ones worth updating first.

Give it a week before you draw any conclusions. One day of data says very little; a week shows a pattern.

A desk with a laptop, printed charts, and a notebook with notes
Source: Pexels

A quick note on privacy

Google Analytics uses cookies to track visitors. If your visitors are in the EU or UK, privacy rules (GDPR and similar laws) usually mean you need a cookie consent banner and a short note in your privacy policy saying you use Analytics. A free consent plugin can handle the banner. If your audience is only in the US, the rules are lighter, but a line in your privacy policy is still good practice. This is not legal advice โ€” if you collect data from many countries, check the rules for each one.

Frequently asked questions

Is Google Analytics free?

Yes. The standard version of Google Analytics 4 is free, with no time limit and no visitor cap that affects small sites. Google also sells a paid enterprise version called Analytics 360, but you do not need it unless you run a very large site.

Can I add Google Analytics to WordPress without a plugin?

Yes. You can paste the Google tag into your site with WPCode, through Google Tag Manager, or by adding it to a child theme. The plugin methods are easier, but the manual methods work just as well.

How long does it take for Google Analytics to show data?

The Realtime report usually shows visitors within a few minutes. Regular reports can take up to 48 hours to start filling in, so do not worry if they look empty on the first day.

Do I need GA4 or Universal Analytics?

GA4. Universal Analytics stopped collecting data in July 2023. Any new setup should use a GA4 property with a Measurement ID that starts with G-.

Will Google Analytics slow down my website?

Very little. The tracking code loads in the background and is small. On most sites the effect on speed is too small to notice. If your site is already slow, Analytics is almost never the cause โ€” check large images and heavy plugins first.

Can I add Google Analytics to a free WordPress.com site?

No. The free WordPress.com plan does not allow tracking code or plugins. You need the Business plan or higher, or a self-hosted WordPress.org site.

How do I know which pages people visit most?

In Google Analytics, open Reports > Engagement > Pages and screens. It lists your pages by views, so you can see what your audience reads most.

Taylor Orlando

Taylor Orlando is a content writer at Meregate covering websites, SEO, and AI. Taylor breaks down complex topics into simple, practical guides that help small businesses build better websites, rank higher on Google, and get real value from AI tools โ€” no jargon, no fluff.

Related Articles