Google Analytics 4 or GA4 is the next generation of Google Analytics launched by Google in Oct 2020. Unlike the old Universal Analytics properties, you can use the new GA4 for a website, an app, or both together.
Using Google’s advanced machine learning models, GA4 delivers exceptional performance in tracking the latest market trends and customer behavior across devices and platforms. The privacy-centric design ensures you can enjoy better ROI, especially for your long-term marketing plans.
In this post, we will discuss how to create a new GA4 account, how to upgrade to new GA4 account, and how to add GA4 tag to your website. Continue reading for step-by-step explanation with screenshots.
Table of Contents
- How to Create a New Google Analytics Account and GA4 Property?
- How to Upgrade to GA4 Property From Existing Universal Analytics Property ?
- How to Add GA4 Tracking Code to Website without Using Google Tag Manager ?
- How to Add GA4 Tracking Code to Website Using Google Tag Manager ?
How to Create a New Google Analytics Account and GA4 Property?
If you don’t have an existing Google Analytics account, you need to create one. When you start creating a new account, Google by default makes Google Analytics 4 as a new property. However, it also allows you to create Universal Analytics, which is explained below in easy-to-understand steps.
Step 1: Log in to Google account and go to https://analytics.google.com/analytics/
Step 2: Click on “Start Measuring” Button.
Step 3: Provide the name of your account as mentioned here (Usually a company name).
Click “Next” after providing the company name.
Step 4: Provide a “Property Name” here and select “Reporting Time Zone” and “Currency”.
Step 5: To make a Universal Analytics Property along with GA4 analytics property click on the “Show Advanced Options” as shown in the image below.
Step 6: Switch the toggle from Off to On, and it will turn bright blue.
Now provide a website URL here and select the option to create either GA4 and Universal Analytics Property or only a Universal Analytics Property.
Click “Next” after selecting the appropriate option.
Step 7: Provide the details “About Your Business” by selecting the option relevant to your business, such as Industry Category, business size, and how do you intend to use Google Analytics with your business.
Click “Create” after selecting all the relevant options to create GA4 and Universal Analytics Property under new Google Analytics account.
Step 8: Check the relevant boxes to accept the Data Processing Terms as required by GDPR and the Measurement Controller–Controller Data Protection Terms of the data.
Now Click “I Accept”.
Step 9: Accepting the terms will land you on the “Web Stream Details” screen, where you can find the Measurement ID in the top right corner.
Congrats!!! You have successfully made GA4 and Google Universal Analytics property.
How to Upgrade to GA4 Property From Existing Universal Analytics Property
If you already have a Universal Analytics Property and want to upgrade to Google Analytics 4 (GA4), here is what you need to do.
Step 1: Click “Admin” as shown below.
Step 2: This will land you on the admin console of the Universal Analytics Property where you can click on “GA4 Setup Assistant” under “Property” column.
Step 3: This will land you on “Google Analytics 4 Property Setup Assistant” screen. Here you need to click on “Get Started“
Note: Make sure you have selected the right account under account column.
Step 4: Clicking on the “Get Started” will show this pop up on your screen. Here you need to click on “Create Property”.
Step 5: This will take you to the following screen where one can see the connected property message with property ID.
Now click on the “See your GA4 property” and you will land on the “Setup Assistant” screen. click the arrow (>) under “Tag Installation” to go to the “Data Streams” screen.
Step 6: Once you are on “Data Stream” screen, click the arrow (>) under “Data Stream,” which will lead you to “Web Stream Details.”
Step 7: On the “Web Stream Details” page, you can find Measurement ID for GA4 property in top right corner.
Congratulations!!! You have now successfully upgraded to GA4 property.
How to Add GA4 Tracking Code to Website without Using Google Tag Manager
There are three ways to add GA4 tracking code to website without using Google Tag Manager.
- Option One: Connect the Measurement ID to existing UA Property in Universal Analytics.
- Option Two: Add a new ‘Config’ directive in the existing code on the website
- Option Three: Copy and Paste the GA4 tracking code script IN the <head> section.
1. Connect the Measurement ID to Existing UA Property in Universal Analytics
If you already have a Universal Analytics code on the website and you want to add GA4 Measurement ID to your site, you need to connect the GA4 Measurement ID under Universal Analytics Property in tracking code under “Tracking Info” under the property column in Google Analytics admin section.
Step 1: Click the “Admin” located on left bottom corner.
Step 2: Click the “Data Streams” and select “Web.” Click the arrow (>) under “Data Stream” which will land you on “Web Stream Details” page.
Step 3: In the top right corner, you can see a GA4 Measurement ID. Copy this ID.
Step 4: Now, go to your existing Universal Analytics Property >> Admin >> Tracking info >>Tracking code.
>> Admin >> Tracking info >>Tracking code
Step 5: Scroll down and you will see “Connected Site Tags” option. Click this option.
Step 6: You can paste the Measurement ID that you created and copied in the Step 3 to create a new site tag.
Once you click on “Connect”, your Universal Analytics property and GA4 property are linked.
2. Add a New ‘Config’ Directive in the Existing Code on the Website
If you already have a (gtag.js) analytics code on the website and you want to add GA4 Measurement ID to your site, this is a second option for you where you can add a second “config” directive to the existing analytics code.
Usually, this is what a gtag.js analytics code looks like on the source page of the website.
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-Property ID');
</script>
After line 8 in the above mentioned gtag.js code, add an additional “config” directive having GA4 Property “Measurement ID”.
After adding an additional “config” directive having GA4 Property “Measurement ID”, the code will look as below:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-Property ID');
gtag('config', 'G-Propert ID');
</script>
In the table below, you can see a usual gtag.js code in the left column. In the right column, you can see the code after adding a new config directive with GA4 Property ID.
Sr. No | gtag.js Code | After adding a new “config” directive to existing code |
1 | <!– Global site tag (gtag.js) – Google Analytics –> | <!– Global site tag (gtag.js) – Google Analytics –> |
2 | <script async src=”https://www.googletagmanager.com/gtag/js?id=UA-183804596-1″></script> | <script async src=”https://www.googletagmanager.com/gtag/js?id=UA-183804596-1″></script> |
3 | <script> | <script> |
4 | window.dataLayer = window.dataLayer || []; | window.dataLayer = window.dataLayer || []; |
5 | function gtag(){dataLayer.push(arguments);} | function gtag(){dataLayer.push(arguments);} |
6 | gtag(‘js’, new Date()); | gtag(‘js’, new Date()); |
7 | ||
8 | gtag(‘config’, ‘UA-Property ID’); | gtag(‘config’, ‘UA-Property ID’); |
9 | </script> | gtag(‘config’, ‘G-Propert ID’); |
10 | </script> |
3. Copy and Paste the GA4 tracking code script in the <head> section.
Step 1: Click “Admin” option located in the left bottom corner.
Step 2: Click the “Data Streams” option, and select “Web” menu. Click on the arrow (>) under “Data Stream” to go to “Web Stream Details” page.
Step 3: Now on the “Web Stream Details” screen, under “Tagging Instructions” tab find “Add New On-Page Tag”. This is where you can find “Global Site Tag (gtag.js).”
Step 4: Copy and paste this code into the <head> of every web page you want to measure.
How to Add GA4 Tracking Code to Website Using Google Tag Manager
There are two Google Analytics 4 tags Google Tag Manager can support.
- Google Analytics: GA4 Configuration
- Google Analytics: GA4 Event
Follow these steps to implement Google Analytics 4 using Google Tag Manager.
Step 1: Log in to your Google account and visit https://tagmanager.google.com/
Step 2: Click “Add a new tag” option under “New Tag.
Step 3: Click “Tag Configuration”
Step 4: Select “Google Analytics: GA4 Configuration” from the “Choose Tag Type” window.
Step 5: Enter GA4 “Measurement ID” as shown in the Image.
Step 6: Click the “Triggering” option.
Step 7: Select “All Pages” from “Choose a trigger” window.
Step 8: Rename this tag from “Untitled Tag” to “GA4 Configuration Tag” or the name of your choice.
Step 9: Click the “SAVE” button to save this tag.
Step 10: You can preview the changes by clicking the “Preview” button
Step 11: Enter the URL of the website and click the “Start” option.
Step 12: Check if the “GA4 Configuration Tag” appears under “Tags Fired”.
Step 13: Now go back to Google Tag Manager Tab and click on the “Submit”.
Step 14: You can edit the “Version Name” and add a detailed description of the changes made in this version.
Step 15: Click “Publish.”
Conclusion
As with all new things, setting up Google Analytics 4 isn’t that easy. With this guide, I have tried my best to make the whole process a lot easier for you to implement it. If you still have any queries, feel free to connect with me on LinkedIn and ask your queries there.