Adding Google Analytics 4 to WordPress: Step-by-Step Guide

Adding Google Analytics 4 to WordPress

Want to add Google Analytics 4 (GA4) to WordPress? You’re in the right place!

In this step-by-step guide, we’ll go over how to add the newest version of Google Analytics, GA4, to WordPress using the best plugin for the job: ExactMetrics.

ExactMetrics is the best plugin to use to add Google Analytics 4 to WordPress because it’s one of the only plugins that allows you to connect both your Universal Analytics and GA4 properties to your WordPress site at the same time.

Ready to get started? Let’s go!

ExactMetrics is the best WordPress Analytics plugin. Get it for free!

Add GA4 to WordPress in 4 Steps

  1. Create a Google Analytics 4 Property
  2. Install and Set Up ExactMetrics
  3. Set Up Dual Tracking
  4. Create an API Secret

Step 1: Create a Google Analytics 4 Property

If you don’t have a GA4 property set up yet, you’ll need to do that first. The instructions for this are different if you already have an Analytics account vs if you need to create one. Let’s take a look at the process for each.

Directions for if you already have a Universal Analytics property
Directions for if you do not have a Google Analytics property set up yet

If you already have a Universal Analytics property…

If you already have a Google Analytics account and a Universal Analytics property, you can go through the process of creating a GA4 property pretty easily by following Google’s Setup Assistant.

To access the assistant, head to the Admin cog then GA4 Setup Assistant in the middle column.

GA4 Setup Assistant

Next, click the blue Get Started button.

Get Started with the GA4 Setup Assistant

Then, click the Create Property button. The last option will either be checked or not based on which version of the tracking tag you currently have installed.

Create property

Your new property is created! Go ahead and click See Your GA4 Property.

See Your GA4 Property

Alright, let’s leave that tab open now and go to the next step.

If you do not have a Google Analytics property set up yet…

If you don’t have Google Analytics yet, follow these steps to set up your account and create both GA4 and Universal Analytics properties at the same time.

The first thing you’ll need to do is log in or sign up for a Google account.

To get started, you’ll need to open the Google Analytics website and click the Sign in to Analytics link or Start for free button in the top right corner of the page.


Next, you can log in to your existing Google account if you have one, or click the Create account link to create a new Google account.

sign in to google

Now, click the blue Start Measuring button.

click the start measuring button

Next, you’ll need to enter the Account name for your Google Analytics account. You’ll also see different data sharing settings. Make sure you check all the boxes and then click Next.


Now, you’ll have to enter the property details of your website. Start by entering a name, selecting a reporting time zone, and choosing your currency.

Then, you can choose from three options:

  • Set up a GA4 property
  • Set up a Universal Analytics property
  • Set up both at the same time (recommended option)

To get the most out of ExactMetrics, we recommend you set up both at the same time. To do that…

To set up both GA4 and Universal properties at the same time, enter your property name and choose your time zone and currency. Then, click the Show advanced options link.

Toggle on the switch to create a Universal Analytics property. Then, fill in your website’s URL and select the checkbox to create both properties. Click Next.

Fill in your business details and click Create. You may see a popup at this point to accept the Google Analytics Terms of Service. Go ahead and check the checkbox and click I Accept.

That’s it! Let’s move on to step 2.

Step 2: Install and Set Up ExactMetrics

Already have the plugin? Skip to step 3.

To start, head to the Pricing page and get started with ExactMetrics. Once you complete checkout, download the plugin.

Download Exact Metrics

Next, upload it to your website.

Upload Plugin Zip File

Now that you have ExactMetrics installed, you can add your license key and connect your Google Analytics account. To get set up, click on ExactMetrics under your WordPress Dashboard and click the big green “Launch the wizard!” button.

ExactMetrics Setup Wizard

Once you’re in the wizard, you’ll get to this page where you can add your license key and connect with Google Analytics:

Connect ExactMetrics

Now, when choosing which Analytics property to connect to, we recommend choosing your Universal Analytics property. Most people choose to connect with Universal Analytics in order to access their Bounce Rate metric.

For more details on this step, check out our guide on How to Add Google Analytics to Your WordPress Site.

Step 3: Set Up Dual Tracking

Here’s how to add your GA4 property to the Dual Tracking box in ExactMetrics.

A GA4 property has a Measurement ID, which is in the format of G-XXXXXXXXXX.

To find your Measurement ID, go to Admin » Property » Data Streams and then click into the data stream:

You’ve located your Measurement ID and now you can add it to ExactMetrics.

First, log into your WordPress site and go to ExactMetrics » Settings.

Under the Google Authentication section, you’ll see a Dual Tracking Profile option.

Copy your Measurement ID and then paste it into the option.

Once you insert the ID, the settings will be saved.

That’s it! You’re now dual tracking both a GA4 and UA property on your WordPress site.

Step 4: Create an API Secret

In order to track eCommerce events and form submissions to your Google Analytics 4 property, you’ll need to create a Measurement Protocol API Secret and insert the generated secret value into your ExactMetrics settings.

Log into and click into the Admin of your GA4 property.

Then, click into your existing data stream.

Within the Additional Settings section, click into Measurement Protocol API secrets.

Click the Create button to create a new API secret and give it a Nickname.

Copy the newly created Secret Value.

Log into your WordPress admin and go to ExactMetrics » Settings and paste the Secret Value into the Measurement Protocol API Secret field.

That’s it! You’ve successfully set up your Measurement Protocol API Secret in GA4.

Your WordPress website is now connected to both GA4 and Universal Analytics. Because you used ExactMetrics and connected both properties, you’ll have the best of both worlds with your tracking.

Now, are you wondering what to track? Read 8 Types of Google Analytics Reports to Track (The Best Ones).

Don’t forget to follow us on Twitter and Facebook to see all the latest Google Analytics tutorials.

Want to Try ExactMetrics for Free?

Enter the URL of Your WordPress website to install ExactMetrics Lite.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.