How to Setup Google Analytics 4 (GA4) – A Complete Guide

10 minutes read
How To Set Up Google Analytics 4

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?

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.

Google Analytics Welcome Screen

Step 3: Provide the name of your account as mentioned here (Usually a company name).

Click “Next” after providing the company name.

Account Name in Google Analytics Under Account Setup

Step 4: Provide a “Property Name” here and select “Reporting Time Zone” and “Currency”.

Property Name - Reporting Time Zone - 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.

Universal Analytics Property along with GA4 analytics property click on the 'Show Advanced Options'

Step 6: Switch the toggle from Off to On, and it will turn bright blue.

Create either GA4 and Universal Analytics Property

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.

business information in about your business section

business information in about your business section- v1

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.

Google Analytics Terms of Service Agreement

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.

Web Stream Details - Measurement ID

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.

Admin section in google analytics 

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.

'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.

'Google Analytics 4 Property Setup Assistant' screen

Step 4: Clicking on the “Get Started” will show this pop up on your screen. Here you need to click on “Create Property”.

Create a new Google Anlytics 4 property

Step 5: This will take you to the following screen where one can see the connected property message with property ID.

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.

Setup Assistant Screen in GA 4 Admin area

Step 6: Once you are on “Data Stream” screen, click the arrow (>) under “Data Stream,” which will lead you to “Web Stream Details.”

Data Streams Screen in GA 4 Admin console

Step 7: On the “Web Stream Details” page, you can find Measurement ID for GA4 property in top right corner.

Web Stream Details Screen in GA4

Congratulations!!! You have now successfully upgraded to GA4 property.

set up GA4 eCommerce Tracking on Shopify

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.

  1. Option One: Connect the Measurement ID to existing UA Property in Universal Analytics.
  2. Option Two: Add a new ‘Config’ directive in the existing code on the website
  3. 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.

Connect the GA4 Measurement ID under Universal Analytics Property in tracking code

Step 2: Click the “Data Streams” and select “Web.” Click the arrow (>) under “Data Stream” which will land you on “Web Stream Details” page.

'Web Stream Details' page

Step 3: In the top right corner, you can see a GA4 Measurement ID. Copy this ID.

Web Stream Details Screen in GA4

Step 4: Now, go to your existing Universal Analytics Property >> Admin >> Tracking info >>Tracking code.

Universal Analytics Property >> Admin >> Tracking info >>Tracking code

Step 5: Scroll down and you will see “Connected Site Tags” option. Click this option.

Universal Analytics Property and Connected Site Tags

Step 6: You can paste the Measurement ID that you created and copied in the Step 3 to create a new site tag.

Create a new site tag - Measurement ID that you created

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.

  1. <!-- Global site tag (gtag.js) - Google Analytics -->
  2. <script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-1"></script>
  3. <script>
  4. window.dataLayer = window.dataLayer || [];
  5. function gtag(){dataLayer.push(arguments);}
  6. gtag('js', new Date());
  7.   gtag('config', 'UA-Property ID');
  8. </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:

  1. <!-- Global site tag (gtag.js) - Google Analytics -->
  2. <script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-1"></script>
  3. <script>
  4. window.dataLayer = window.dataLayer || [];
  5. function gtag(){dataLayer.push(arguments);}
  6. gtag('js', new Date());
  7. gtag('config', 'UA-Property ID');
  8. gtag('config', 'G-Propert ID');
  9. </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.

Connect the GA4 Measurement ID under Universal Analytics Property in tracking code

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.

'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).”

Web Stream Details >> Tagging Instructions >> Add New On-Page Tag >> 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.

  1. Google Analytics: GA4 Configuration
  2. 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.

Tag Manager - Add a new tag

Step 3: Click “Tag Configuration”

Google Tag Manager >> Tag Configuration

Step 4: Select “Google Analytics: GA4 Configuration” from the “Choose Tag Type” window.

Google Tag Manager >> Choose Tag Type >> Google Analytics: GA4 Configuration

Step 5: Enter GA4 “Measurement ID” as shown in the Image.

Google Tag Manager >> Tag Configuration >> GA4 'Measurement ID'

Step 6: Click the “Triggering” option.

Google Tag Manager >> Tag Configuration >> GA4 'Measurement ID' >> Triggering

Step 7: Select “All Pages” from “Choose a trigger” window.

Google Tag Manager >> Tag Configuration >> GA4 'Measurement ID' >> Triggering >> All Pages >> Choose a trigger

Step 8: Rename this tag from “Untitled Tag” to “GA4 Configuration Tag” or the name of your choice.

Rename this tag from 'Untitled Tag' to 'GA4 Configuration Tag'

Step 9: Click the “SAVE” button to save this tag.

Rename this tag from 'Untitled Tag' to 'GA4 Configuration Tag' - SAVE

Step 10: You can preview the changes by clicking the “Preview” button

 

Google Tag Manager - Preview

Step 11: Enter the URL of the website and click the “Start” option.

Start Tag Assistant - Enter the URL of the website

Step 12: Check if the “GA4 Configuration Tag” appears under “Tags Fired”.

GA4 Configuration Tag appears under Tags Fired

Step 13: Now go back to Google Tag Manager Tab and click on the “Submit”.

Google Tag Manager Tab - Submit

Step 14: You can edit the “Version Name” and add a detailed description of the changes made in this version.

Tag Manager - Version Name - Detailed Description

Step 15: Click “Publish.”

Tag Manager - Version Name - Detailed Description - 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.

  • Darshk Patel is an SEO Analyst who specializes in Google Analytics and Google Tag Manager. With his immense knowledge in Google Analytics and Google Tag Manager, he has helped many businesses to accurately track their website traffic leading to a better understanding of user behaviour and conversion rate.