CYBER MONDAY: Get Lifetime Access to All Themes & Plugins for only $399 - 24/100 Licenses remaining View Details →

Switching Your WordPress Website to Google Analytics 4 (GA4): Why and How

How to switch to Google Analytics 4

Google announced that Universal Analytics will no longer process new hits from the 1st of July, 2023. Therefore, to keep collecting data, you’ll need to switch to Google Analytics 4 (GA4). However, you might be unsure how to do this.

Fortunately, it’s easy to switch your WordPress website to GA4. Then, you can continue tracking metrics on your site once Universal Analytics is no longer available.

In this post, we’ll take a closer look at Google Analytics and discuss why it’s necessary to transition to GA4. Then, we’ll guide you through three easy steps to do this. Let’s get started!

Universal Analytics vs. Google Analytics 4

Universal Analytics (UA) became widely used in 2014 as the new version of Google Analytics, replacing Classic Analytics. By 2016, all Classic Analytics properties were automatically transferred to UA.

Now, Google Analytics 4 (GA4) is set to take over from UA on the 1st of July, 2023:

Google Analytics notification banner to switch to GA4

Although you’re able to use GA4 similarly to UA, there are some key differences between the platforms. For instance, GA4 enables you to track WordPress websites and apps in the same property. But with UA, you’d have to track these separately. Additionally, GA4 offers better data privacy

What’s more, GA4 and UA use different analysis models. While UA is based on sessions and page views, GA4 opts for an event-based model. This includes anything from page views to clicks, enabling you to track more complex buyer journeys.

Why Switch to Google Analytics 4?

Google cited user behavior changes and privacy standards as the main reasons for the switch. However, there are additional motivations for the transition from UA to GA4.

For example, GA4 can collect a lot more data than UA. Plus, it provides more insight into what people are doing on your site thanks to its event-based data model and cross-platform tracking.

Moreover, GA4 uses historical data to provide better insights. Better yet, it offers powerful features like tracking cohorts, which are groups of similar users. 

Most importantly, since UA won’t be available after the 1st of July, it’s important to make the switch to GA4 before this date. Otherwise, you’ll no longer be able to track your visitors, and Google won’t support the platform or introduce new features for it. Meanwhile, all standard Universal Analytics properties will stop processing new hits.

How to Switch to Google Analytics 4 with WordPress (In 3 Steps)

Now that you know why it’s time to transition from UA to GA4, let’s look at how to do this in three simple steps!

Step 1: Create Your Analytics Property

First, log in to your Universal Analytics account. Then, click on Manage GA4 migration:

Manage Google analytics 4 migration

Next, click on Get Started underneath I want to create a new Google Analytics 4 property:

Create a new Google Analytics 4 property

This will launch the setup assistant, which will generate a new GA4 property with the basic details of your existing UA property. Just hit Create and Continue:

Create a new GA4 property

Wait a few seconds while the setup assistant works in the background.

Step 2: Create a Google Tag

You’ll now see a popup window asking you to either create a new tag or choose an existing one. We recommend picking an existing tag by clicking on Use a Google tag you already have, followed by Choose a tag:

Choose a Google tag

Click on the tag from the dropdown list and hit Confirm at the top of the page. Then, click on Go to your GA4 property:

Go to GA4 property

Now that your property is ready, you must locate your Google tag. From your Google Analytics dashboard, use the dropdown menu at the top of the screen to select your property. Then, return to the Admin button at the bottom of the sidebar menu:

Google Analytics Admin

This time, click on Setup Assistant:

Google Analytics Setup Assistant

Now, select Data Streams from the menu to your left:

Google Analytics Data Streams

If you chose an existing Google tag in the previous step, you should see the data stream within this screen. Simply click on it to access the tag.

Alternatively, Choose Web as your data collection platform:

Web data stream

Enter your Website URL and Stream name to finish setting up your stream. Then, click on Create stream:

Create a Google Analytics data stream

At this point, you’ll be given some installation instructions for your Google tag. By default, you’ll be shown how to install your Google tag using a CMS platform. Instead, switch to Install manually:

Install your Google tag manually

Now, copy the tag to your clipboard.

Step 3: Install the Header, Footer, and Post Injections Plugin and Add Your Google Tag

When using WPZOOM themes, there’s a field to add the header code in your theme framework. However, it’s best not to have your Google tag dependent on your theme. Instead, we recommend adding your tag directly to your website.

Although you can do this manually, it can be time-consuming, and you might make a mistake. However, with a plugin, you only need to add one line of code, and the software automatically implements your tag across your website.

One of the best WordPress plugins for this task is Header, Footer and Post Injections. To install it on your site, go to Plugins Add New. Then, search for the plugin using the search bar. Select Install Now, followed by Activate:

Activate the Header, Footer, and Post Injections plugin

Now, head to Settings > Header and Footer. You’ll want to add your analytics code to every website page after the <head> element. Therefore, you’ll need to use <HEAD> PAGE SECTION INJECTION:

Add your Google tag

As you can see, there are two options for this setting. You can either apply the tag to every page of your site or just the homepage. Choose the ON EVERY PAGE option and paste your Google tag:

Paste your Google tag

Finally, click on the Save button at the top or bottom of the page.

Frequently Asked Questions

Although we’ve already explained how to switch to GA4, you might still have some queries. In this section, we’ll answer some of the most common questions!

Should I Remove the UA Tag From My Website?

Many marketers will continue to use Universal Analytics along with GA4 until the 1st of July. This way, you’re able to get acquainted with the new generation of Google Analytics. After that date, you can remove the UA tag from your website and continue with GA4.

Will I Lose All My Previous Analytics Data?

Even once UA falls out of use, you’ll still be able to access your property’s data for six months. Additionally, you can export its data using the Google Analytics Reporting API. Alternatively, if you’re a Google Analytics 360 customer, you can export your data to BigQuery.


From the 1st of July 2023, Universal Analytics will no longer process new hits. Therefore, if you want to continue using the service, you’ll need to make the switch to Google Analytics 4.

To recap, here are three steps to switch your WordPress website to Google Analytics 4:

  1. Create your analytics property.
  2. Find and copy your Google tag.
  3. Install Header, Footer, and Post Injections to add your Google tag. 

Do you have any questions about switching to Google Analytics 4? Let us know in the comments section below!

Related Posts

Subscribe to the WPZOOM newsletter.

Join 150,000 people. Get our latest news & releases delivered to your inbox.

1 Comment
  • I’ve switched it to yet as i don’t get a time. But by reading your blog i realise i should switch it as its easy. Thanks Pavel for your help.

Leave a Reply