Are you looking for the most straightforward method to install Google Analytics 4 on your WordPress site?
It is crucial to make the transfer as soon as possible if you want to build up historical data in your new Google Analytics 4 property before Google stops supporting the previous version of Google Analytics on July 1, 2023. Thus it is essential to make the switch as soon as possible.
Thankfully, it’s not a complicated procedure at all. After making the switch, you will also be able to utilize the modernized tools and capabilities available in Google Analytics (GA).
In this piece, we’ll take a more in-depth look at the new capabilities that have been added to Google Analytics. Afterward, we will walk you through upgrading to Google Analytics 4 in WordPress. Let’s get started!
Google Analytics 4 Overview
New features in Google Analytics 4 are aimed to give businesses more accurate data while respecting user privacy. It’s been a while since Google Analytics 4 was first released, but it will soon be replaced by Universal Analytics (UA).
Data collection by UA will end in 2023, as Google recently revealed. The moment has come to upgrade to Google Analytics 4 and become comfortable with the new user interface.
Google Analytics gathers information from both websites and applications. Customers’ lifecycles are also taken into consideration when creating reports. You’ll be able to observe, for example, which websites are bringing in visitors to your pages, what those visitors are doing, and whether or not they make a purchase or engage with your content:
As you may have seen, the digital marketing industry is shifting away from cookies. Google and other search engines are shifting their focus away from third-party cookies in favor of their own.
GDPR-compliant website owners can take advantage of new data granularity in Google Analytics 4. The new consent option, for example, allows you to modify the behavior of your Google tags following a user’s privacy settings.
Consider the fact that GA4 is based on events rather than on sessions. These are all named after a specific user action:
It’s possible to see the number of events in a country by going to page view. After clicking on an event, you’ll be able to obtain additional details about it. Pages viewed, downloads, and more are all examples of events that may be included.
AI-powered insights can help you plan your marketing initiatives more efficiently with the help of GA4. You can use analytics intelligence to forecast your site’s future, including sales and conversions. These insights might help you improve your marketing approach and target the right audience.
How to switch your WordPress site to Google Analytics 4 (in 3 steps)
Now, let’s look at how to change WordPress to use Google Analytics 4.
Step 1: Make a new Google Analytics 4 property.
Step 2: Get your GA4 code for tracking
Step 3: Put the code on your website.
Step 1: Make a new Google Analytics 4 property.
Create a new Google Analytics 4 Property as the first step if you haven’t already.
Note: If you set up your Google Analytics property in the last year or so, you may have already set up a GA4 property along with your Universal Analytics property, as Google was heavily pushing this method in the interface. If so, you can go straight to the next step.
To get started, sign in to your Google Analytics account and click on Admin in the bottom left corner of your screen.
Make sure to choose the correct GA account in the Account column. Then, select your current Universal Analytics property in the Property section. Then, click on the option GA4 Setup Assistant:
Click on Get started in the box that says, “I want to make a new Google Analytics 4 property.” This will open a window that pops up.
If you’ve used the global site tag (gtag.js) code to add Universal Analytics to your site, you’ll see an option to Enable data collection using existing tags. If you choose this, GA will use the tracking code already on your site to gather data, so you won’t have to add it again.
But don’t worry if you don’t yet have the GA tracking code on your site. In the next step, we’ll show you how to add it.
In either case, the next step is to choose Create Property. When the process is done, you will see this message:
Here are some ways to set up your new property. If you’ve already put the GA tracking code on your site, there’s nothing else you need to do. If not, you can go to the next step.
Step 2 get your GA4 tracking code
Next, you will need to retrieve your GA4 tracking code. Navigate to the Collection section and click Tag installation in the Setup Assistant.
You should find the following under Data Streams:
If you click on it, a window will appear with information about your stream:
Next, select the Global site tag (gtag.js) option under Tagging instructions. Then, your Google Analytics tracking code will appear:
Step 3: Integrate the tracking code into your site
Finally, you must link your WordPress site to your newly created Google Analytics 4 property. There are two primary ways to accomplish this, both of which are simplified by plugins. You can include your Google Analytics tracking code in the header of your website, or you can consist of your measurement ID using a Google Analytics plugin. Let’s examine each approach in detail.
Putting the tracking code in the header or footer of your page is one option.
The tracking code can be added to your header section to utilize GA4 on your site.
Using a plugin, such as Head, Footer, and Post Injections is a better option than doing this manually with a child theme.
Adding code to your footer and header without editing your child theme’s files is a huge time saver. In this manner, you will not lose these options if you switch to a different theme.
Installing and activating the plugin on your WordPress site is the first step. Go to Header and Footer in Settings, then to the Head and Footer tab in Header and Footer:
Adding code to your footer and header without editing your child theme’s files is a huge time saver. Make sure you save these settings from being used even if you switch to a different theme.
Installing and activating the plugin on your site is as simple as going to your WordPress dashboard and doing so. The Head and Footer tab may be under Settings > Header and Footer.
In the HEAD> PAGE SECTION INJECTION section, paste your GA tracking code (from the previous step). The ON EVERY PAGE box must be filled in.
Please remember that the GA tracking code should be included in your site’s head. Because header scripts tend to load before the remainder of your page, they can keep better tabs on your site’s traffic and user activity. and also remember the Google Search Console, where you index your all URL and sitemap for crowling your web page.
It’s also possible to place the code in your footer. Copy your code and put it BEFORE THE /BODY> CLOSING TAG to accomplish this. Remember that this approach may not give you the most accurate picture of your site’s visitors’ behavior.
Utilize the complimentary GA Google Analytics plugin
Additionally, you can enable GA4 on your website using the free GA Google Analytics plugin.
Once the free plugin from WordPress.org has been installed, head to Settings > Google Analytics in your WordPress dashboard and click on Plugin Settings:
You must enter the measurement ID for your new Google Analytics 4 property in the GA Tracking ID area. This information is available on the Web stream details page described in step two.
In the Tracking Method field, choose Global Site Tag. Then, click Save Changes to complete the process. Note that data may not appear in your Google Analytics account for up to 48 hours.