How to Add Google Analytics 4 to WordPress (And What Is GA4 Anyway?)

Google has big hopes for its Google Analytics version 4. In fact, it calls it “the next generation of Google Analytics” – their own words. To say the least, Google Analytics 4 is (going to be) a big deal! It’s probably a good idea not to miss the bandwagon and learn how to add Google Analytics 4 to WordPress today.

In this guide, we will tell you what Google Analytics 4 is and how it is different from the previous edition of Google Analytics – called Universal Analytics. Then, we’re going to show you how to enable it on your WordPress website.

Google Analytics 4 – what it is 💪

Google Analytics seems like a product that worked perfectly well and was probably complicated enough already, right? Who needs a new version?! 🤷‍♂️

The long story short is that v4 is Google’s answer to the ever-increasing popularity of mobile and the need for a more flexible way of collecting data.

The way things used to work with Universal Analytics (UA) all happened around pageviews. GA4, on the other hand, is based on events. Moreover, with this new version of Google Analytics, you can track not only a website but also an app that you might have alongside your website.

Apart from that, Google Analytics 4 also has its own new spin on reports and report looks. Among them: a new home report, real-time report, games reporting, monetization reports, and more.

Overall, Google Analytics 4 is the next step for analytics – a more modern and optimized solution.

However, there are some limitations of Google Analytics 4 to be aware of. Mainly, GA4 doesn’t yet connect to the Search Console (or other Google products), and there’s no cross-domain tracking possible. If you’re using WooCommerce, tracking your sales metrics (like conversions) also doesn’t work (yet).

“Will I lose my current Google Analytics panel after I switch?”

The good news is that you don’t have to lose any sleep over it at this point. In this early stage of Google Analytics 4’s adoption, you can run both Universal Analytics and Google Analytics 4 simultaneously.

How to get started with Google Analytics 4 🤔

Here’s the kicker, the recommended way of setting your site up with Google Analytics 4 is to run it alongside UA and not instead of it.

Just to emphasize this again, in the recommended setup, you’re going to be running both UA and GA4 at the same time – at least for now. As GA4 matures, we might see UA go away, but that’s not where we’re at yet.

Here’s how to set up Google Analytics 4 and then integrate it with your WordPress website:

1. Sign up to Google Analytics

💡 Note; If you already have an account with Google Analytics and your website hooked up to it, you can skip to step #3.

The first step is to create a new Google Analytics account and create a standard – UA – property for your website.

To begin, go to analytics.google.com and log in to your Google account (the one you use for Gmail).

You’ll see the main welcome screen:

Google Analytics welcome

Google Analytics will invite you to get started. The account creation process isn’t too complicated, but you’ll need to go through a couple of forms.

Google Analytics setup

2. Create a UA property

After getting the account set up, it’s time to add a “property.” A property is Google Analytics’ fancy term for the website that you want to track.

From the admin panel of Google Analytics, click on + Create Property to begin.

Create a property in Google Analytics

Again, at this stage, Google Analytics will ask you for some necessary details about your site. The important part is to click on the Show advanced options button and then enable UA by switching this toggle button:

Google Analytics property form

Once you have all the required info filled in, click on Create.

After a couple of seconds, you should see a confirmation screen. This is where you’re going to get your unique tracking ID and the tracking code snippet that you can use to integrate your site with Google Analytics later.

Google Analytics Universal Analytics setup done
  • Need help on how to get through the basic setup with Google Analytics? Read this official doc.

3. Add a Google Analytics 4 property

With your UA property alive and well, let’s now add a GA4 property alongside.

Luckily, Google Analytics makes this really easy with the official GA4 Setup Assistant. To access it, go to the Admin section of your current property – find the link in the bottom left corner of the GA interface:

Google Analytics admin link

In the Property column, there’s a link labeled GA4 Setup Assistant. Click on it to begin.

GA4 Setup Assistant

The on-screen wizard will get you through the steps needed. It’s all very clear.

GA4 Setup Assistant process

Click on Get Started to create a new property. This whole process consists of just a single step. You’re literally one click away from having your new Google Analytics 4 property up and running.

Google Analytics 4 property up and running
  • Need help with the GA4 Setup Assistant? Read this official doc.

From this screen, click on the button labeled See your GA4 property. This will land you on an intro screen where you’ll be able to get your global site tag – a piece of code used to integrate your site with Google Analytics.

Google Analytics 4 welcome

Click on Tag installation to begin.

Your main web data stream should be there on the list.

Google Analytics 4 web stream

This page holds all the info you need to integrate your WordPress site with Google Analytics 4. The most important piece of data is your measurement ID.

To get your GA4 embed code, expand the section labeled Global Site Tag (gtag.js):

Google Analytics 4 global tag

You can copy and paste it someplace handy.

4. How to embed your GA4 code in WordPress

There are two ways you can do this:

  • manually
  • with the help of your theme

Let’s start with the latter.

First, check if your theme came with any Google Analytics integration out the box. If it did, using it will be the easiest way to add Google Analytics 4 to your WordPress site.

For example, in Blocksy, you can add your Google Analytics 4 code (and UA code) when you go to the WordPress Customizer and then into Visitor Engagement → General.

Blocksy engagement

From there, you can add both your standard UA ID and your new GA4 ID.

Blocksy add Google Analytics 4

This is literally all you have to do to enable GA4 in Blocksy. Just publish the changes in Customizer, and you’re done!

In other themes, you might find these settings in different places.

⚠️ Important; some WordPress themes won’t allow you to enable Google Analytics 4 through their existing integrations with Google Analytics. For instance, it’s common for themes to require a UA- ID to integrate with your Google Analytics. The new v4 ID starts with G- and this by itself might be enough to prevent the theme from allowing it (not to mention the lack of code structures to handle it under the hood).

If your theme doesn’t come with a built-in integration, you can either:

  • use a Google Analytics plugin (just go to the official plugin directory and put “Google Analytics” into the search box, there’s plenty of those things), or
  • include the code manually in the source files of your theme – usually in the footer.php file or through a hook in functions.php (the plugin route is more straightforward, honestly).

That’s it! 🍾

You now have GA4 up and running. Go to the new Google Analytics dashboard and check out what’s going on. The real-time views panel is fascinating – something that the previous versions of Google Analytics were not that good at. Remember, you can always use a Google Analytics alternative.

Lastly, give Blocksy a try! See how easy it is to integrate it with Google Analytics – though that’s just the tip of the iceberg. Blocksy offers a lot more, and for free!

If you have any questions about how to use Google Analytics 4 with WordPress, let us know in the comments below.

Karol K
Karol K

Karol K. is a WordPress figure-outer, blogger, and the author of "WordPress Complete" (Packt/Amazon). Hit him up on Twitter (@iamkarolk) if you'd like to connect.

Articles: 11

One comment

  1. Worth to mention that WooCommerce users should still use old analytics – the latest one (v4) is still under maintenance and conversions doesn’t work well… even doesn’t work at all 🙂

Leave a Reply

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