How to configure Google Analytics 4 using Google Tag Manager?

How do I set up Google Analytics 4 using Google Tag Manager?

Google Analytics 4 is a measurement solution that replaces Universal Analytics. As of July 1, 2023, the standard properties of Universal Analytics will stop tracking new visits to your website. Therefore, it is important to prepare for Google Analytics 4 if you are still using Universal Analytics.

What is Google Analytics 4?

Google Analytics 4 is an advanced analytics tool that allows you to measure traffic and engagement on your website or app.

Compared to the old version of Universal Analytics, which bases its analysis on cookies and statistics on page views during sessions, Google Analytics 4 better takes into account the behavior of Internet users across different touchpoints using Machine Learning. This new version is based on tracking different types of events by analyzing several interactions such as page scrolling, file downloads, etc.

By configuring Google Analytics 4, you can:

 Improve your ROI with data-driven attribution:

With its “Data-Driven Attribution” feature, Google Analytics 4 provides more accurate and actionable insights than ever before to analyze the total impact of your marketing throughout the customer journey. Plus, it helps you understand how your marketing activities collectively influence your conversions. This allows you to export your analytics to Google Ads and Google Marketing Platform media tools for campaign optimization.

Measure engagement and conversions with business needs and compliance in mind:

With new country-level privacy controls, you can manage and minimize user-level data collection – such as cookies and metadata – while preserving key measurement features.

Get more value from your data:

Machine Learning generates sophisticated predictive insights about user behavior and conversions, creates new audiences of users likely to buy or unsubscribe, and automatically highlights critical information to improve your marketing.

Easily activate your information:

Extensive integrations with other Google products, such as Google Ads, work across all of your web and app data, so you can easily use Analytics information to optimize your campaigns.

→ 7 mistakes you should never make in Google Analytics 4 Configuration

What is Google Tag Manager (GTM)?


Google Tag Manager is a tag management system (TMS) that allows you to quickly and easily update measurement codes and associated code snippets, referred to as tags, on your website or mobile app. Once the small Tag Manager code segment has been added to your project, you can easily and securely deploy analytics and measurement tag configurations from a web-based user interface.

With Google Tag Manager, you can track visitor behavior on your website, such as:

  • CTAs clicked
  • Top selling products and categories and their generated revenue
  • Subscriptions to your newsletter
  • AdWords conversions
  • Clicks on a given product
  • Downloads of a document on the site (PDF, white paper, etc.)
  • Clicks on “add to cart”
  • Products removed from the cart
  • The use of a discount coupon
  • The depth of the scroll on the page
  • Cart abandonment in the order funnel
  • Video triggering and playback time

→ Do you want to set up your website tracking strategy and achieve your business objectives effectively?

How do I set up Google Analytics 4 using Google Tag Manager?

With a new interface and modified primary metrics, GA4 also requires a different setup process to set up tracking tags.

Google Tag Manager (GTM) provides a simple path to set up GA4 on your site and create custom events.

To set up Google Analytics 4, you need to follow these steps:

1. Start by setting up the GA4 code

The gtag.js tag is the basic tracking code you need to place on your site. Once you enable it for all pages, you will start recording all the default data that GA4 tracks for site visitors.

With GTM, setting up this tag is very simple: just a few clicks and entering an account ID. However, it is essential to note that if you already have a Universal Analytics tag (analytics.js) enabled on your site, you should leave it in place by adding the Analytics 4 tag to keep your data history. GA4 will only record data once you have configured it.

To start configuring your GA4 tag, access the account and container of your choice in GTM and select “Add a new tag”.

Add a new tag to GTM
Add a new tag to GTM

Click on “Tag Configuration” to see the options for the different tag types. Select Google Analytics: GA4 Configuration.

GA4 Configuration
GA4 Configuration

At this point, you can enter your measurement ID.

Add measurement ID
Add measurement ID

Choose where you want the tag to be triggered on your site. Depending on your configuration, you can exclude certain pages or choose to track all pages on the site.
→ What will be the impact of Google Analytics 4

2. Set up event tracking for GA4 in Google Tag Manager

One of the major enhancements GA4 offers is automatic event tracking. You can trigger events for actions that previously required you to create them manually, such as scroll activity, outbound clicks, file downloads, and video views directly in the Google Analytics interface and using the “Enhanced Metrics” feature.

One of the major enhancements GA4 offers is automatic event tracking
One of the major enhancements GA4 offers is automatic event tracking

However, note that these events still have limitations compared to the more advanced tracking options you can configure via GTM. You can use the GA4 Event tag to create events for all triggers available in GTM. This will allow you to have more detailed and accurate data to track visitor behavior on the site.

In order to create an event on GA4 using Google Tag Manager, you can proceed as follows:

First, create a new tag with a Tag Type “Google Analytics: GA4 Event”. Choose your GA4 ID under “Configuration Tag”.

create a new tag with a Tag Type "Google Analytics: GA4 Event"
create a new tag with a Tag Type “Google Analytics: GA4 Event”

Then, enter the name of the event you want to appear in the Google Analytics interface. Then click on the Event Settings section if you want to send additional details about the event to Google Analytics.
→ Do you wish to set up a web analysis strategy and achieve your business objectives effectively?

To determine the KPIs you want to track, you need to create a new trigger by clicking in the bottom triggers section.

Finally, save the trigger, save your tag, and publish it. You should now see detailed data displayed when you view the Events section in Analytics.

If you haven’t set up Google Analytics 4 for your site yet, feel free to contact our experts for guidance.