SEO & Analytics

How to Install Google Analytics on WordPress

Step by step GA4 tracking for beginners

Install Google Analytics on your WordPress site to start collecting accurate traffic and conversion data from day one. In this tutorial you will connect a Google Analytics 4 property, install the free Site Kit by Google plugin, and confirm that page views are being tracked correctly.

By the end, you will have a working GA4 setup on WordPress, a simple way to check that tracking works, and clear next steps for using reports. If you want a broader overview of metrics later, read the WordPress seo complete beginners guide.

What You Need to Start

  • An active WordPress site with admin access to /wp-admin.
  • A Google account you can use for Analytics.
  • Basic ability to install plugins on your WordPress site.
  • Optional but recommended access to a staging site if you test changes before going live.
If you normally test changes first, follow the workflow in How to use ai in WordPress before installing new plugins.

Step 1: Create your Google Analytics 4 property

First, create or confirm your GA4 property so WordPress has somewhere to send data. You only do this once per website.

  1. Sign in to Google Analytics with your Google account.
  2. Click the Admin gear icon in the lower left of the Analytics interface.
  3. Under the Account column, choose your account or create a new one if needed.
  4. Under the Property column, click Create property, then enter a descriptive name (for example, your site name plus “GA4”).
  5. Choose your Reporting time zone and Currency, then click Next and complete the business details.
  6. When prompted for What do you want to measure, choose Web and click Next.
  7. Enter your WordPress site URL and a clear Stream name, then click Create stream.
  8. On the stream details screen, note your Measurement ID (starts with “G-”). You will not need to paste it manually when using Site Kit, but it is useful for verification.

Open the new web data stream to double check that your domain is correct and that GA4 shows a valid Measurement ID.

Step 2: Install Site Kit plugin in WordPress

The easiest and safest way to install Google Analytics on WordPress is with the official Site Kit by Google plugin. It automatically inserts the tag on every page and keeps tracking code up to date.

  1. Log in to your WordPress admin dashboard at https://yoursite.com/wp-admin.
  2. In the left menu, navigate to Plugins » Add New.
  3. Use the search box in the top right to search for Site Kit by Google.
  4. Locate the plugin named Site Kit by Google – Analytics, Search Console, AdSense, Speed.
  5. Click Install Now, then after installation click Activate.

Confirm that Site Kit now appears in your left admin menu and that the plugin is listed as Active under Plugins.

WordPress Add Plugins screen displaying the active Site Kit by Google plugin, an essential tool for installing Google Analytics (GA4).
The WordPress ‘Add Plugins’ page shows the active Site Kit by Google plugin, a recommended solution for integrating Google Analytics.
Avoid installing multiple Analytics plugins at the same time. Running two GA tags together can cause duplicate page views. If you previously followed another guide such as Google Analytics for WordPress Setup and Tracking Basics, disable any older tracking methods before continuing.

Step 3: Connect Site Kit to Google Analytics

Next, connect Site Kit to your Google account and link it to the GA4 property you created. Site Kit will then add the Google tag to your theme automatically.

  1. In your WordPress dashboard, click Site Kit in the left menu.
  2. On the Site Kit welcome screen, click Sign in with Google.
  3. Choose the same Google account you used for Analytics, then review the requested permissions and click Allow.
  4. Complete the on-screen steps to verify site ownership and connect Site Kit to your Google account.
  5. After the initial connection, go to Site Kit » Settings » Connect more services.
  6. Find Analytics and click Set up or Connect.
  7. In the setup flow, select your existing Google Analytics account, the correct GA4 property, and your Web data stream.
  8. Confirm any additional options (such as who can view reports), then click Finish or Save.

When you return to the Site Kit dashboard, you should see Analytics listed as a connected service without errors.

Google Site Kit plugin setup in WordPress dashboard, showing options to connect Google Analytics and display SEO data.
The Google Site Kit plugin helps integrate essential Google services like Analytics directly into your WordPress dashboard for better SEO insights.
If you later decide to manage tags through Google Tag Manager instead of Site Kit, use the dedicated tutorial Analytics setup WordPress google analytics and remove any duplicate Analytics tags.

Step 4: Confirm that GA4 tracking works

Before relying on your reports, confirm that page views are being recorded. You can check this in both Google Analytics and inside Site Kit.

  1. Open a new private or incognito browser window.
  2. Visit your WordPress site homepage and click through to one or two posts.
  3. Return to Google Analytics, open your GA4 property, and go to the Reports section.
  4. Under Realtime, confirm that at least one active user appears, and that the Page path or Screen class list shows the pages you just visited.
  5. In WordPress, go to Site Kit » Dashboard and check that basic Analytics summaries load without any connection errors.

If you see yourself as a realtime user and Site Kit displays Analytics data, your GA4 install on WordPress is working correctly.

Google Analytics 4 (GA4) reports snapshot showing key SEO performance metrics for a WordPress site, including active users, new users, engagement time, traffic sources, and country data.
This Google Analytics 4 report provides essential data for understanding and optimizing a WordPress site’s SEO performance.

Once tracking is live, use the deeper walkthrough in How to do seo for WordPress blog to interpret blog metrics and traffic sources.

Step 5: Add Google Analytics code manually without a plugin

If you prefer to minimize plugins or cannot use Site Kit, you can install Google Analytics by pasting the GA4 tag directly into your theme or via a header script plugin. This requires more care, but gives you full control.

  1. In Google Analytics, open your GA4 property and web data stream.
  2. Under Tagging instructions, locate the Google tag (gtag.js) snippet and copy it.
  3. In WordPress, install a header script manager plugin from the official directory (for example, one that lets you add code to the <head> of every page).
  4. Go to the plugin’s settings page and paste your Google tag snippet into the site-wide Head field.
  5. Save your changes and clear any caching plugin or CDN cache so new visitors get the updated code.
WordPress Theme File Editor with GA4 Google Analytics tracking code snippet added to the header.php file.
Theme File Editor with GA4 Google Analytics tracking code snippet added to the header.php file.” width=”1100″ height=”522″> A screenshot demonstrating the manual addition of Google Analytics 4 (GA4) tracking code to a WordPress site’s header.php file.
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXX');
</script>

Replace G-XXXXXXX with your real GA4 measurement ID. Then repeat the verification steps from Step 4 to confirm tracking is live.

Do not edit theme files directly in a live parent theme. If you ever change themes, your Analytics code will be lost. Using a header script plugin or a child theme is safer. For more advanced configuration ideas, see How To Configure Google Analytics For WordPress.

Conclusion You Are Ready to Go

You have now installed Google Analytics on WordPress, connected a GA4 property, and confirmed that page views are being tracked correctly. Whether you used Site Kit or a manual snippet, your site is sending traffic data to Analytics so you can measure performance, identify top content, and track conversions over time.

From here, refine your reporting setup by defining events, tracking conversions, and segmenting your audience. Combine this guide with other analytics-focused tutorials on WPHeadliner to build a complete measurement plan for your blog, store, or business site.

Further Reading

Frequently Asked Questions

Do I need a plugin to install Google Analytics on WordPress

No. You can install Google Analytics either with a plugin (such as Site Kit by Google) or by adding the GA4 tag manually to your site’s header. However, plugins make setup safer for non-developers and reduce the risk of mistakes when themes or tracking requirements change.

Can I use both Site Kit and another Analytics plugin at the same time

You should avoid running multiple plugins that all add Google Analytics tags to your pages. If two different plugins inject GA code, every page view can be counted twice, which inflates traffic and breaks engagement metrics. Use one primary method and disable any older tracking setups.

What is the difference between Universal Analytics and GA4 on WordPress

Universal Analytics properties stopped processing most standard data, so new WordPress setups should use Google Analytics 4 only. GA4 uses an event-based data model and different reports. When you install Google Analytics today, make sure you are working with a GA4 property and a measurement ID that starts with “G-”.

Will Google Analytics slow down my WordPress site

The GA4 script is lightweight and loads asynchronously, so it usually has minimal impact on performance. Problems arise when you add many extra third-party scripts, run multiple Analytics tags, or ignore basic speed optimization. To balance tracking and speed, follow a performance guide such as other speed optimization articles on WPHeadliner.

Should I track logged in admin users in Google Analytics

In most cases, you should exclude admin and editor visits so your own page views do not distort metrics. Some Analytics plugins include a setting to ignore logged in users. If you use Site Kit, you can also filter out internal traffic in GA4 by creating a data filter that excludes your IP or specific traffic rules.

Can I switch from a manual Google Analytics install to Site Kit later

Yes. First, install and configure Site Kit so it connects to your existing GA4 property. Then remove any manually added GA4 code from your theme or header script plugin to prevent duplicates. After cleanup, only Site Kit should be injecting the Google tag on your pages.

How do I start tracking specific actions like form submissions

Basic GA4 page tracking works immediately after installation, but events such as form submissions require extra setup. Start with tutorials like tracking blog conversions or GA4 event tracking for forms, then configure events and conversions in GA4. Site Kit sends page views automatically, but you still need to define which actions count as key conversions.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button