How to Setup Google Analytics 4 with Google Tag Manager

2022/03/12·5 min read

About Universal Analytics

This page is showing example of how to setup Universal Analytics for learning purpose, please be aware the Google Universal Analytics will no longer process new data beginning July 1, 2023. You'll have to switch to Google Analytics 4 Property.

Create GA4 Property

At here, we'll try to create GA4 property, if you have existing account with the old Universal Analytics you can use the same account and create a new property and use the GA4 Setup Assistant to setup GA4. GA4 Setup Assistant

Choose the option that want to create a new Google Analytics 4 Property. Crate GA4 - Get Started

Click Create Property to create new GA4 property. Once create a GA4 property make a note for the mesurement ID, because we'll need later the value to add to the Google Tag Manager. Create GA4 Property

Create new Google Tag Manager Container

Here, create a new Google Tag Manager container under your account. GTM Code Snippet

Install Google Tag Manager into Your Site

Then go to the admin section and follow the instruction to use the code snippet and add back to your site. Once add Google Tag Manager code to the site, later we can configure additional tags or scripts to load to the site. Here add new tag and add the Google Analytics GA4 Configurations GTM - GA4 Configuration

Add Google Analytics GA4 Configuration

Add the GA4 mesurement ID, so Google Tag Manager's GA4 configuration will connect to the new GA4 Analytic's measurement ID. GTM - GA4 Configuration with Measurement ID

Now, if you load the page with the GTM script you add before should be loading the script for the GA4 start collection default data and send to Google Analytics, such as page view.