- 2022-08-07 : Added notes on trigger type (see "Added on 2022-08-07")
- 2022-06-23 : Revised the explanation of the page view triggers and which one is better to set when using the tag manager, since more types of page view triggers ware added.
- 2020-02-05 : Article published
With the release of Google Analytics 4 (GA4), many people are starting to set up. This time, I will summarize how to add properties for GA4 and use them together with Universal Analytics property. It's easy to set up, but there's one thing to keep in mind when setting up with Google Tag Manager (GTM).
Google Analytics Settings
Click "GA4 Setup Assistant" from the Property menu.
Once the menu opens, click "Get Started".
Then a modal window will appear.
It is important to note that if you are using GTM, you need to clear the checkbox at the bottom of the modal window.
This checkbox says "Enable data collection using your existing tags."
If this checkbox is not unchecked, GA4 will not be measured correctly even if you set up GTM described below.
The official Google help page states the following, by the way.
If your site uses the gtag.js, tag, you have the option to Enable data collection using your existing tags. However, if you use a website builder/CMS (e.g. Wix, etc), Google Tag Manager, or your website is tagged with analytics.js, the wizard can't reuse your existing tagging and you'll need to add the tag yourself (instructions).
Uncheck the box and click "Create Property" to create a new property for GA4.
Google Tag Manager settings
As it is, there will be no measurement for GA4, so we need to add a tag for GA4 in GTM.
First, check the measurement ID for GA4 in Google Analytics.
In the newly added properties for GA4, click on "Data Streams" and then click on the arrow icon of the name that appears.
Click on "Tagging Instructions" > "Use existing on-page tags" in the configuration window that appears.
Then click on "Google Tag Manager".
You will see the measurement ID, copy it.
Next, open GTM and add a new tag.
Select "Google Analytics: GA4 Configuration" as the tag type.
Then, paste the ID that you just copied into the Measurement ID.
The triggers should be on all pages.
The following five types of
page view triggers have been added.
The precedence order in which triggers are fired is also in this order.
- Consent Initialization
- Page View
- DOM Ready
- Window Loaded
For more information on each of them, please see the official documents below.
I will explain the
Consent Initialization later in the article.
Well, previously I wrote we should use a trigger type of
However, now a new trigger type has been added, and it seems that selecting
Initialization rather than
Page View will give you the result you intend.
This is because if another event tag is fired before the GA4 configuration tag is fired, GA4 will not be able to measure the event correctly.
The official documentation also states the following
Google Analytics 4 property, and should be triggered to fire as soon as possible, before any other Google Analytics 4 event tags.
Once you have selected
Initialization for the trigger type, all you need to do is publish the tag manager and you are done.
Added on 2022-08-07
It is dangerous to choose "initialization" for everything.
As mentioned in another article "Cookie Consent Banner plugin Cookie Consent and how to use it with GTM", there were cases where "initialization" was selected and the measurement did not work correctly.
Make sure you understand the firing order of the trigger types, test them, and confirm the firing of the tags in the GTM preview before publishing.
Make sure GA4 is being measured properly
In Google Analytics, go to the properties of GA4, and in the Realtime report, if you can confirm that the real time report is working correctly, the setting is complete.
What is Consent Initialization?
As you saw, there is a trigger type,
Initialization is confusing, but
Consent Initialization is even more confusing.
Consent Initialization is an event for users who use
Consent Management Platforms.
These platform are also called
Consent Management Platform is a service that manages approvals for data collection for users of websites and applications.
This is just a part of the features.
If you use these services with Tag Manager, the use of this
Initialize Consent event type is suitable.
The following information from the Tag Manager help page may be helpful for better understanding.
The Consent Initialization trigger is designed to help you ensure that all consent settings are honored before any other triggers fire. The Consent Initialization trigger is used for tags that set or update the user consent state for your site, such as a consent management platform tag or tags that set consent defaults.
Each web container includes a Consent Initialization - All Pages trigger by default. Select this trigger to fire any tags that require it.
The Consent Initialization trigger is not used for tags that should fire early on a site. For tags that aren't specifically used to manage consent settings, use an Initialization trigger instead. The Consent Initialization trigger will always fire before all other tags, including any Initialization triggers.
Quote : Consent configuration - Tag Manager Help
Also, please see the article on the Google Marketing Platform that mentions this issue.