Google have changed the way we set up Google Analytics 4 (GA4) in Google Tag Manager.
Anyone who is familiar with setting up GA4 will notice that the option for Google Analytics 4 Configuration is no longer available and has been replaced with Google Tag.
Having just set up GA4 with Google Tag Manager for a client, I wanted to share with you how to do it in 2024 with step-by-step images so you can follow along.
This article will cover the following:
To begin with, head over to Google Analytics and click, Start measuring.
Make sure you’re logged into the right Gmail account that you’d like attached to your Google products.
Enter your company name, or website name.
Leave the ticked boxes that are already selected, unless you would like to unselect any specifics – I leave them as they come with the top unselected.
Set the name of the property, this is your company name, or blog’s name.
Make sure you select the correct time zone for your country and update the currency to match.
Set your business details for the industry category and size.
Set your business objectives for what you’d like to track.
For the business I am setting this us up for they will not be making sales so I have left this unchecked.
If you are setting up for an ecommerce store make sure to select Drive online sales.
On the popup window, make sure to select the country / region from the dropdown that you are accepting the Terms of Service in.
Tick the box below and select Agree.
Once you have accepted the Terms you need to select your data stream.
For websites, and this guide in particular, we will be selecting Web.
Enter the URL for your website and give it a name.
Make sure the https protocol is selected – this is usually automatically selected but if it is not, choose https from the dropdown.
Select Create stream.
You will then be given installation instructions for installing manually or with a website builder or CMS.
We will be installing manually with Google Tag Manager.
Make sure you are logged into the same Gmail account that you have started setting up Google Analytics with.
Go to Google Tag Manager and click Create Account on the right-hand side.
Enter the account name; this can be your company or blog name or URL.
Select your country and give your container a name, again, your company name.
Select the platform you are installing this on, we will be selecting Web.
After you select Create you will have to read and accept the Terms of Service Agreement.
Tick the accept box and select Yes up in the rop right-hand corner.
Before you can move onto the next bit, you now need to install the Google Tag Manager code to your website.
Copy the <head> script by pressing the copy icon in the top right-hand side inside the first box.
Head over to your WordPress website and log in.
This next bit is really important as you can cause issues with your website if you get this wrong.
If you’re not confident doing this yourself, consider having a web developer do this bit however, I will provide step by step guidance for you to follow to make sure you do so correctly.
Find Appearance in the left-hand side of your dashboard.
Select Theme file editor from the last option under Appearance on the left.
Make sure you have the correct theme selected from the dropdown in the top right-hand side.
If you have more than one installed the correct one is the active one.
Find Theme Header in the right-hand side of your Theme files.
It is good practice to make a copy of your Theme Header code before you make any changes in case you need to revert back.
I save this in a Word document safely in OneDrive.
Script 1
Script 2
If you are using the Elementor plugin and their templates you will need to add your Google Tag script using their plugin.
If you add these scripts using the previous method in WordPress Theme files it will not be found by Google.
Find Elementor in the left-hand side of your dashboard.
Select Custom Code then Add New.
Set the name of this script so you can differentiate between the <head> and <body> codes later on – I have called this one, Google Tag Manager Head Tag.
Paste the <head> script in the box.
In the Location dropdown select <head> and leave the priority set to 1.
When you select Publish it should automatically have the Condition selected for Entire Site, however, if that is not the case update it to Entire Site and click Save.
Then, paste your <body> script in the text box and give it a name – I have called this one, Google Tag Manager Body Tag.
This time, in the Location dropdown select <body> – Start and leave the priority set to 1.
Again, when you select Publish you will need to make sure the Condition is set to Entire Site and click save.
Head back over to your Google Tag Manager tab, enter your website URL and hit Test.
If Google successfully picks up your tracking code you will see a green tick in the test box.
Click OK and you will be brought to your new Google Tag Manager Workspace.
Click New Tag within your Workspace.
This is where you’ll notice things are a little different.
You now need to select Google Tag from the tag types.
In the new window, enter the name of this Tag – I called this the Google Tag Configuration.
To find your Tag ID, head back into your Google Analytics tab.
Navigate to your Measurement ID in the Web stream details.
Copy this using the copy icon to the right of the ID and paste in the Tag ID box back in Google Tag Manager.
Back in Google Tag Manager, select Initialization – All Pages for the Trigger.
This will ensure this Tag is the very first trigger, even before other GA4 event tags.
Click Save in the top right-hand corner.
Now it’s time to test everything is working.
Click Preview from the options along the top of your Workspace.
In the popup window enter your website URL and click Connect.
In the left-hand side of the debug window you should see the Initialization Tag fire.
If you click on this you will also see it was successful in the Tags Fired Output.
Finally, notice Google Tag and Google Analytics appear along the top, this also confirms that both have fired correctly.
As a final check, you can also look inside your new Google Analytics under the Real Time report and look for a new Page View hit.
You can now click Submit along the top right-hand side to publish your changes and make this live.
You will then be brought to this screen.
To get back to your Workspace click on the X on the top left-hand corner.
You can go back to your Google Analytics page and hit Next.
It will then show that data collection is pending.
Click Continue to Home and then you will be asked for your email communications preferences.
Select whichever settings you’d like to hear about and click Save.
You’ll see a hit in your Google Analytics which tells you that everything has set up correctly.
And that’s it!
This will connect the new Google Tag with Google Analytics and allow you to add future code to your website quickly in future.
If you don’t see any data in your new Google Analytics dashboard, come back in a day or two as it can take up to 48 hours for data to start flowing.
This new Google Tag allows for more accurate, automatic tracking, such as:
If you’re interested in setting up custom event tracking for Google Analytics I will be updating this blog soon with steps on how to do that soon.
Kent, United Kingdom