Add Google Analytics to WordPress (Without Double-Tracking)

How-To Ridgemoormedia Editors

Set up GA4 on WordPress and check that your visits are tracked.

Understand Google Analytics 4

Google Analytics 4, or GA4, is Google's current analytics tool. It tracks activity as events. Page views, clicks, and file downloads can each count as events.

Reports can show where visitors came from and which pages they viewed. One property can track activity across a website and an app. Start with the measures that help you make site decisions.

If you wonder how to add Google Analytics to WordPress, first choose one setup method. You can use Site Kit, add the tag by hand, or use Google Tag Manager. Do not run more than one copy of the GA4 tag.

  • Use page views to see which pages draw visits.
  • Track key actions, such as form sends or sales.
  • Review traffic sources to learn how people find your site.

Prepare to Add Google Analytics

Sign in to the Google account that should own your site data. Open Analytics and create a property for your WordPress site. Choose a clear name, time zone, and currency. Then create a web data stream.

Enter your website address when you set up the stream. Google will give you a Measurement ID that starts with “G-”. This ID points to the right GA4 stream. Keep it nearby for setup.

To find it later, open Admin > Data streams in Analytics. Select your web stream to see its Measurement ID and tag details. Google's GA4 setup instructions explain how to create a property and stream.

Before adding a tag, check whether your theme or another plugin already loads Analytics. Two copies can count one visit twice. Also make sure you can safely change plugins or site settings.

Desk setup for preparing a WordPress site and GA4 data stream
Prepare a WordPress site for GA4

Choose a Way to Connect GA4

There are three common ways to add Google Analytics to a WordPress site: Site Kit, manual code, or Google Tag Manager. The best choice depends on your comfort with site settings and the tags you need.

Site Kit offers guided setup and basic reports in WordPress. Manual code suits people who can safely edit header settings. Tag Manager gives more control over tags and events. It also adds another tool to manage.

MethodGood fit forKeep in mind
Site KitGuided setup and basic reportsCheck for a second tag
Manual codePeople who can edit site settingsTheme changes may remove code
Tag ManagerSites with several tags or eventsPublish the right container

Use the Measurement ID from your web stream, whichever method you choose. Avoid pasting several copies of the tag across your site. That simple check prevents many tracking errors.

Use Site Kit by Google

For many site owners, Site Kit is the simplest way to connect Analytics to a WordPress blog or website. In your dashboard, go to Plugins > Add New. Search for Site Kit by Google, then install and activate it. Check that Google is the publisher.

Open Site Kit and follow the setup steps. Sign in with the account that owns the Analytics property. Grant the access it asks for, then connect your site. If you have not set up Analytics, Site Kit can help create or link a property.

Open the Analytics settings in Site Kit after setup. Check that the right property and web stream are selected. Site Kit adds the tag for you, so do not also paste the same code into your theme. See Google's Site Kit documentation for setup details.

Wait briefly for data to arrive. Visit your site in a new browser tab, then check the Realtime report in Analytics. If your visit appears, the tag is sending data.

Laptop and notebook representing a simple Site Kit analytics setup
Connect Analytics with Site Kit

Add the GA4 Tag by Hand

Manual setup can suit site owners who know how to edit header settings. In Analytics, open Admin > Data streams. Select your web stream and open the tag instructions. Copy the full Google tag code, not just the Measurement ID.

Add the code to your WordPress site header so it can load on every page. You can use a trusted header-code plugin or a theme feature for custom scripts. Avoid editing a parent theme's files, since an update can erase your change.

If you edit theme files, use a child theme and back up your site first. Place the code inside the header area, before the closing head tag. If you are unsure where that is, use a plugin or ask your host for help.

This is one way to add the Google Analytics tag to WordPress without an Analytics plugin. A misplaced tag may not load, while a duplicate can count visits twice. After saving, clear your site cache and test the page again.

Use Google Tag Manager

Tag Manager can help when your site needs several tags or custom events. Create a container for your site, then add the Google tag and your GA4 Measurement ID. Check the setup before you publish the container.

Use Tag Manager's preview mode to test whether the tag fires on your pages. Then publish the changes. This route can work well for a site with several tracking needs, but it adds another tool to maintain.

Choose one main method for your GA4 tag. Do not add the same tag through Tag Manager and Site Kit at once. That can lead to duplicate page views and poor reports.

Check Tracking and Fix Common Issues

After setup, open your site in a fresh browser tab and view the Realtime report in Analytics. Some visits may take time to show in standard reports. Realtime is a useful first check, but it does not confirm every event is set up well.

If no visit appears, check the Measurement ID against the web stream. Next, make sure the code sits in the site header and loads on public pages. Clear your cache, then test again.

Ad blockers, privacy tools, or consent settings can prevent a test visit from appearing. Check with a second browser or device. Also pause any other Analytics plugin while testing, so only one tag sends data.

People often ask how to check Google Analytics in WordPress or view WordPress analytics. Site Kit can show basic reports in the dashboard, while the full reports live in Analytics. If you want to put Google Analytics on WordPress without a plugin, manual code is an option. For most new users, Site Kit is easier to set up and check.

Got a project this applies to?

Bring us the rough idea and the rough budget. We will tell you what fits.

Start a project