How To Safely Switch To Google Analytics 4 in WordPress

How To Safely Switch To Google Analytics 4 in WordPressWould you like to safely switch from Universal Analytics to Google Analytics 4 in WordPress? Google Analytics 4 is the latest version of the web performance tool. It comes with enhanced measurement protocol.

Google recommends that site owners migrate to this newest release before July 1st, 2023. This is because Universal Analytics will stop tracking web data and generating reports.

In this complete guide, we’ll explain what Google Analytics 4 is and why you should switch to the latest version of GA4. You’ll also learn how to migrate safely to Google Analytics 4 in WordPress.


What is Google Analytics 4?

Google Analytics 4, also known as GA4, is the latest version of the digital analytics tool. It was launched in October 2020 and integrates directly with media platforms to drive more sales to your web and mobile apps.

GA4 provides more accurate reports for businesses while protecting user privacy. Best of all, it allows you to track web and app data on a single analytics property.

Google Analytics 4 dashboard

With the new GA4 dashboard, you can track the entire user journey. For instance, you can see the page users access your website from, and the actions performed while on your site. You can also see where they go after making a purchase or abandoning their cart.

GA4 dashboard

Further, Google Analytics 4 offers controls that help digital marketers and website owners to comply with GDPR. With the consent mode, you can control the behavior of Google tags based on the user’s preferences.

Below are some default data collection types that GA4 keeps track of.

  • Total number of users
  • Statistics of each user’s session
  • Approximate user location (Geolocation)
  • Browser and device information

GA4 vs. Universal Analytics

The notable difference between GA4 and Universal Analytics is that GA4 reports activities on your website and app from a single analytics property.

Additionally, Google Analytics 4 has a new look. The new dashboard comes with advanced features that enable you to create custom events. You can use the event parameter to track activities that matter to your business.

Pageviews were the most important metric on Universal Analytics. However, with the new Google Analytics 4, all measurements are events. Instead of generic data, you can customize your data to generate custom metrics in Google Analytics 4.

In addition, the new Google Analytics has a dedicated menu for advertising. This means you can track your ad performance from the advertising menu. This can be helpful if you run search ads using the Google Ads platform on your website or mobile app.

Google Analytics 4 Advertising menu

GA4 also integrates well with Google Data Studio. This allows you to create responsive dashboards to represent your Google Analytics 4 reports.

Why You Should Switch to Google Analytics 4

The main reason why you should switch to GA4 is that Google plans to retire the old Universal Analytics dashboard by July 1st, 2023.

Universal Analytics dashboard

When this happens, Universal Analytics will stop receiving reports in your analytics dashboard. You will lose any historical data from the UA because Google will not migrate old data from Universal Analytics to the new Google Analytics 4.

Aside from that, Google Analytics 4 also comes with a host of new features that make tracking your website performance easier.

For starters, Google Analytics 4 allows cross-platform tracking. This saves you from creating multiple properties for tracking your sites and apps.

Additionally, GA4 uses Events instead of session-based data to track user interaction. This leads to more accuracy and better data tracking. You can access the events through Life cycle >> Engagement >> Events.

Google Analytics 4 Event tracking

You’ll see more information about a particular event when you click on it. GA4 will list all the pages accessed through that medium and the time users spend on a specific page.

Page-view infomation

If you are still new to GA4, we’ll show you how to enable dual tracking on your WordPress site. That way, you can access your Universal Analytics and Google Analytics 4 reports from your WordPress admin dashboard.

How to Switch to Google Analytics 4 in WordPress

Now you know what GA4 means and why you should switch from Universal Analytics to GA4. We’ll walk you through the steps to safely migrate to Google Analytics 4.

Sidenote: We assume you already have Google Analytics enabled on your website and are looking to switch to GA4. But if you don’t have a Google Analytics account, please refer to our guide to learn how to create and link GA in WordPress.

Creating a Google Analytics 4 Property

To start, you’ll need to log in to your Google Analytics account and click on Admin on the bottom section of the page.

Admin section of GA4 account

On the “Admin” tab, you’ll see details about your existing UA property. There is also a link to set up GA4 on the page. To proceed, click on GA4 Setup Assistant.

GA4 Setup Assistant

Here, you’ll have two options. You can either connect to an existing GA4 property or create a new one. Since we are just getting started, we’ll create a new analytics property. For this, click on Get Started below the ‘I want to create a new Google Analytics 4 property’ option.

Create a new analytics property

A new popup will appear with details of the installation process. To create a GA4 property, click on the Create Property button.

Click the Create Property button

You’ll see an alert that Google Analytics 4 has been connected. To access the GA4 dashboard, click on Go to your GA4 property.

Click the Go to your GA4 property button

It will open the Admin page for the new GA4 property in a new tab. Here, you can continue configuring your new dashboard.

Configure new dashboard

If you used the Global site tag to add Google Analytics to your WordPress site, you don’t need to do any extra configuration. It will automatically update your site settings to include the new GA4 tag.

However, if you need to add the tag to your website, follow the steps below.

Adding Tracking Code to WordPress

There are 2 ways to add the tracking code to your WordPress site: Manually add the code to your theme’s header or use an Analytics plugin to automatically add the code to your website. We’ll cover both methods here.

Using MonsterInsights Plugin

MonsterInsights is an analytics plugin that lets you connect your website to Google Analytics. With this plugin, you won’t need to manually add the tracking code to your WordPress site.

MonsterInsights Plugin

To get started, you’ll need to install and activate the MonsterInsights plugin on your website. Once the installation completes, you’ll be taken to the setup wizard page.

Alternatively, you can access the setup wizard by going to Insights >> Settings. Then click on Launch Setup Wizard to begin the process.

Click on Launch Setup Wizard button

On the “Setup Wizard” page, you’ll first need to select your website type and then click on Save and Continue.

Select website type and save

Next, you’ll need to connect your website with Google Analytics. For this, click on the Connect MonsterInsights button to continue.

Connect website with Google Analytics

After that, you need to choose the Google account linked to your GA4 property.

Choose Google account linked to GA4 property

Next, click Allow to grant MonsterInsights permission to access your Google account.

Grant MonsterInsights permission to access your Google account

Once your account is connected, you’ll see all your Google Analytics properties. You need to select the GA4 property you created from the dropdown. After that, click on Complete Connection.

Select your Google Analytics 4 property

The rest of the process is straightforward. Simply click on Save and Continue to complete the setup.

set up Google Analytics 4 with MonsterInsights

That’s it. You’ve successfully added your GA4 property to your WordPress site.

Manually Adding the Tracking Code

Before adding the tracking code to your WordPress site, you’ll need to copy the code from your Google Analytics 4 property dashboard. For this, go to the Data Stream section. Here, you’ll see all your web and app data streams. To proceed, click on your website’s data stream.

Google Analytics 4 Data Stream

When you click on it, a popup with installation instructions will appear. Under the “Google tag” section, click on Configure tag settings.

Click Configure tag to get Google Analytics 4 code

Next, you’ll need to click on the Installation instructions button to continue.

Google Analytics 4 Installation instructions

On the ‘Install Manually’ tab, you’ll see your GA4 tracking tag. You can copy the code by clicking on the Copy icon.

Copy Google Analytics 4 tracking tag

You’ll need to add this code to your website’s <head> tag. You can use a plugin such as WPCode (Insert Headers and Footers) to manually add the Google tag to your theme’s header.

WPCode (Insert Headers and Footers) plugin

After installing and activating the plugin, go to Code Snippets >> Header & Footer to access the plugin’s settings page.

Add Google Analytics 4 code to WordPress

Within the “Header” block, paste the code you copied from Google Analytics. Once that is done, be sure to click the Save Changes button.

Sidenote: After adding the code, it will not fill the GA4 analytics dashboard with old data from Universal Analytics. It will start populating future data moving forward.

Accessing Both Properties

You can still access both Google Analytics 4 and Universal Analytics properties from your GA dashboard. To switch between them, click the Select Property dropdown and choose between the GA4 or UA property.

Choose between the Google Analytics 4 or UA property 

Setting Up Dual Tracking in WordPress

With the MonsterInsights plugin, you’ll be able to track Universal Analytics and Google Analytics 4 metrics from your WordPress dashboard.

To set this up, log in to your WordPress dashboard and then go to Insights >> Settings to open the plugin’s settings page.

On the “General” tab, you’ll need to enter your UA tracking code in the “Dual Tracking Profile” box.

Enter UA tracking code

You can get the UA tracking code from your Google Analytics dashboard. When you click on the Select Property dropdown, you’ll see the tracking ID next to the property name.

Get UA tracking code from Google Analytics 4 dashboard

Alternatively, you can click on the Tracking Code option within the UA property and copy the code from the preview section.

Universal Analytics tracking ID

After adding the code to your WordPress website, be sure to click the Save Changes button.

Click Save Changes to enable dual tracking 

Frequently Asked Questions

These are answers to some of the questions users asked about the new Google Analytics 4 tracking tool.

Is Google Analytics 4 better?

Yes. With Google Analytics 4, you get more tracking options. This is helpful for eCommerce tracking as you’ll be able to track your visitor’s activities and know what they like.

Is Google Analytics 4 free?

Google marketing platform is free for all, regardless of your business size and the type of content you share. And you can create unlimited GA4 properties on your analytics account.

Can I run GA4 and Universal Analytics on the same account?

For now, you can continue tracking using both analytics tools. However, Universal Analytics will stop receiving reports by July 1st, 2023. So it’s best to start collecting data in your new GA4 property.

Should I switch to Google Analytics 4?

The simple answer is Yes. Google plans to retire the old Universal Analytics. When it stops processing data, you won’t be able to track your website traffic using UA. You’ll lose historical data even after migrating to GA4.


To sum up, the new GA4 comes with many useful tools for content marketers. It enables you to track reports for your website and mobile application using a single property.

Aside from the additional tracking option available in Google Analytics 4, You need to migrate if you hope to continue tracking analytics data on your WordPress site.

In this guide, we have shown you how to migrate to GA4 and begin tracking website performance with the new tool.

Google Analytics helps you understand your visitors’ behavior when browsing your website. If you want to track your WordPress URLs, check out this guide to learn how to use UTM to track URLs in WordPress.

 This post was written by Mesheal Fegor

Mesheal Fegor is a Web/WordPress Developer and technical writer. His WordPress help articles have been featured on Kinsta and other sites. Mesheal holds a master's degree in computer science. His writing focuses on technical WordPress issues, ranging from core WordPress problems, to issues with WooCommerce, and more.

Last edited by: FixRunner Team