fbpx

Morrison Digital Media

How to Switch to Google Analytics 4 in WordPress (The RIGHT Way)

How to Switch to Google Analytics 4 in WordPress (The RIGHT Way)

Are you looking to switch to the latest Google Analytics version?

Google is now recommending website owners to move to the new Google Analytics 4 because they will be sunsetting the previous Universal Analytics on July 1, 2023. After the sunset day, you won’t be able to track data in the older version.

In this article, we’ll show you how to easily switch to Google Analytics 4 in WordPress.

Switch to Google Analytics 4 in WordPress

Why Switch to Google Analytics 4?

Google Analytics 4 (GA4) is the latest version of Google Analytics. It lets you track your mobile apps and websites in the same account, and offers new metrics, reports, and tracking features.

If you haven’t created a GA4 property yet, then now is the best time to switch to the latest version. That’s because Google announced that it will be closing down the old Universal Analytics on July 1, 2023.

What this means is that Universal Analytics will no longer receive data from your WordPress website, and it will eventually stop working after the sunset date. That means that all your old analytics data will be lost.

Switching to Google Analytics 4 as soon as possible will protect you from starting from scratch with no historical data.

To do this right, a lot of smart website owners are using the dual tracking method which allows you to continue using the current Universal Analytics while start sending data to GA4.

This way, you can future-proof your data while giving yourself plenty of time to learn the new Google Analytics dashboard and features.

That being said, let’s see how you can switch to Google Analytics 4 in WordPress with dual tracking.

Creating a Google Analytics 4 Property

If you already have an existing Google Analytics account using the old version, then you can easily create a new GA4 property and start sending stats to GA4.

First, you’ll need to visit the Google Analytics website and login to your account.

After that, head over to the ‘Admin’ settings page in the bottom left corner.

Click admin settings

If you’re on classic Google analytics, then you’ll see the option to setup GA4.

Go ahead and click on ‘GA4 Setup Assistant’ under the Property column.

Click on GA4 setup assistant

In the next step, the setup assistant will give you 2 options. You can create a new Google Analytics 4 property or connect an existing one.

Since we’re setting up a new property, simply click the Get Started button under the ‘I want to create a new Google Analytics 4 property’ option.

Create a new GA4 property

A popup will now appear with the details about the setup wizard.

If you’ve implemented your Universal Analytics using the Global Site Tag (gtag.js) code, then you’ll see an option to Enable data collection using existing tags.

This uses the existing tracking code on your site to collect information. That said, if you don’t already have the right tracking code on your website, we’ll show you how to add it to your WordPress blog below.

For now, you can go ahead and click the ‘Create property’ button.

Click the create property button

The setup wizard will add a new GA4 property and copy the Universal Analytics property name, website URL, timezone, and currency settings.

You can now view your new Google Analytics 4 property in the GA4 Setup Assistant.

View your connected property

Next, you’ll need to click on the ‘See your GA4 property’ button to see your Google Analytics tracking code.

After clicking on the button, simply click on the ‘Tag installation’ option to retrieve your tracking code.

Go to tag installation

You should now see your new GA4 property under Data Streams.

Go ahead and click on your new property.

Select your data stream

A new window will slide in from the right, and you’ll be able to see your web stream details.

Note: Google Analytics 4 uses both ‘data stream’ and ‘web stream’. These both simply mean the flow of analytics data that Google Analytics receives from your website.

Simply scroll down to Tagging Instructions section and click the Global site tag (gtag.js) option to expand the settings. You’ll now see your Google Analytics tracking code that needs to be added to your WordPress site.

See web stream details

One thing you need to know is that Google Analytics 4 reports are quite different than what you’re used to in Universal Analytics.

They have introduced new terminology, and many familiar metrics and reports are missing completely. Basically if you were using common reports like the Top Landing Pages report or others, then you’d have to recreate those from scratch in Google Analytics 4.

That’s why we recommend using MonsterInsights Pro or even the free version of MonsterInsights.

It will help you see all the familiar analytics reports right in your WordPress dashboard, and it also lets you use both Universal Analytics and Google Analytics 4 at the same time.

Not to mention, with MonsterInsights you get all the powerful tracking features such as outbound link tracking, author tracking, and more which can be enabled without writing any code.

Let’s take a look at how to easily set up Google Analytics 4 on your WordPress site with MonsterInsights.

Adding Google Analytics Tracking Code to WordPress Site

The best way to add Google Analytics tracking code to your WordPress website is by using MonsterInsights. This is the plugin that we use on WPBeginner.

MonsterInsights is the best Analytics solution for WordPress, and it’s trusted by over 3 million websites because it lets you easily setup advanced tracking without any coding skills.

You can use the MonsterInsights Lite version to set up Google Analytics in no time. There are also premium MonsterInsights plans that offer more features like custom dashboard reports, email summaries, scroll tracking, eCommerce tracking, premium integrations, and more.

MonsterInsights also offers dual tracking, meaning you can use both Universal Analytics and Google Analytics 4 at the same time. This is available in both the free version as well paid, and we highly recommend using this to ensure that your transition to GA4 goes smoothly.

First, you’ll need to install and activate the MonsterInsights plugin. For more details, please see our guide on how to install a WordPress plugin.

Upon activation, you’ll be taken to the MonsterInsights welcome screen in your WordPress dashboard. Simply click the ‘Launch the Wizard’ button to add Google Analytics to your site.

Launch setup wizard

After clicking the button, the setup wizard will ask you to choose a category that best describes your website.

You can choose from a business website, publisher (blog), or online store. Once you’ve selected a category, click the ‘Save and Continue’ button.

The MonsterInsights setup wizard

In the next step, you’ll need to connect MonsterInsights with your WordPress site.

Go ahead and click the ‘Connect MonsterInsights’ button.

Connect MonsterInsights with your site

Once you click the button, you’ll need to sign in to your Google Account.

Simply select your account and click the ‘Next’ button.

Choose Google account to sign in

Next, MonsterInsights will require access to your Google Analytics Account.

MonsterInsights App needs these permissions, so it can help you setup analytics properly and show you all the relevant stats right inside your WordPress dashboard.

You can click the ‘Allow’ button to continue.

Allow access to your Google account

After that, you’ll be redirected back to the MonsterInsights setup wizard.

To complete the connection, select your Google Analytics 4 property from the dropdown menu and click the ‘Complete Connection’ button.

Select your GA4 property

Next, MonsterInsights will connect Google Analytics with your WordPress website.

On the next screen, you’ll see some recommended settings like file download tracking and affiliate link tracking.

You can use the default settings in the setup wizard. However, if you’re using an affiliate link plugin, then you’ll need to enter the path you use to cloak the affiliate links.

Recommended settings

Next, you can scroll down and select who can see reports and add different WordPress user roles.

Once you’re done, click the ‘Save and continue’ button.

Who can see the reports

After that, MonsterInsights will show different tracking features that you can enable for your website.

You can scroll down and click the ‘Skip for Now’ button.

Choose which tracking features to enable

Next, you’ll see a checklist showing that you’ve successfully connected Google Analytics to your website.

For example, it will show that you’re successfully connected to Google Analytics, the tracking code is properly installed, and the data is being collected.

Tracking should be all setup

That’s it, you’ve added Google Analytics 4 property to your WordPress site.

Creating a Measurement Protocol API Secret

If you want to MonsterInsights to track eCommerce purchases, form conversions, and more advanced tracking in Google Analytics, then you’ll need to create a Measurement Protocol API Secret.

First, you’ll need to go back to your Google Analytics account and then go to Admin settings. Next, click on the ‘Data Streams’ option under Property column.

Go to admin and data stream settings

Then you’ll need to select the Google Analytics 4 property that we created earlier.

Go ahead and select your property under Data Streams.

Select your data stream

After that, you can scroll down to the ‘Advanced Settings’ section.

Simply click the ‘Measurement Protocol API secrets’ option.

Select measurement protocol API secrets option

A new window will now slide in with your Measurement Protocol API secrets.

You will have to click the ‘Create’ button.

Create an API key

After that, enter a nickname for your API secret so it’s easily identifiable.

When you’re done, click the ‘Create’ button.

Enter a name for your API

You should now see your Measurement Protocol API secret.

Simply copy the API secret under the ‘Secret value’ field.

Copy the secret value

After that, you can head back to your WordPress website and navigate to Insights » Settings from your dashboard.

Now click on the ‘General’ tab at the top.

General settings tab in MonsterInsights

Next, you will have to scroll down to the ‘Google Authentication’ section.

Go ahead and enter the Secret value you just copied in the Measurement Protocol API Secret field.

Enter measurement protocol API secret in MonsterInsights

You’ve successfully added Measurement Protocol API Secret in MonsterInsights.

Setting Up Universal Analytics Dual Tracking

Now that you have setup GA4, the next step is to enable dual tracking for Universal Analytics, so it can run alongside your Google Analytics 4 property in WordPress.

With MonsterInsights, you can easily set up dual tracking and simultaneously track both properties without writing code.

Note: If you already have Universal Analytics tracking code added to your WordPress website, then we recommend disabling it first. Otherwise, it could lead to double-tracking and can skew your data.

To start setting up dual tracking properly, you can head to Insights » Settings from your WordPress admin panel and then click on the ‘General’ tab.

General settings tab in MonsterInsights

Next, you’ll need to scroll down to the ‘Google Authentication’ section.

Now under the Dual Tracking Profile, enter your Universal Analytics (UA) code.

Enter your UA Code

You can easily find your UA code in Google Analytics Admin settings.

Simply go to the Admin settings page in Google Analytics of your Universal Analytics property.

Click admin settings

Then click on ‘Property Settings’ under the Property column.

You should see the Tracking Id, and it will look like this: UA-123856789-5

Find your tracking ID

You’ve now successfully set up dual tracking on your WordPress website.

To see how your website is performing, simply go to Insights » Reports. Here you’ll find all the data you need to make the right decisions to grow your website.

Dashboard reports

We hope this article helped you learn how to switch to Google Analytics 4 in WordPress. You may also want to see our ultimate WordPress SEO guide to improve your rankings, or see our comparison of the best email marketing services for small business.

1 thought on “How to Switch to Google Analytics 4 in WordPress (The RIGHT Way)”

Leave a Comment

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