setting up Google Analytics 4 using Google Tag Manager
In this article, we will find a way to get the Google Tag Manager web container to send events to GA4. To help you maintain tags in Google Tag Manager.
To continue with this guide assumes that you have completed the following:
- Create a Google Analytics 4 account and property
- Create a web data stream for your website
If you are not ready, you can go back to the article Setting Up Google Analytics for Magento to understand.
Google Tag Manager helps you centrally manage all your GA4 data and events in one place through two types of cards that work together, GA4 Configuration and GA4 Event.
Ok let’s do it step by step:
1. Set up and install Tag Manager
Once you are signed in to your Google Account, redirect to the Tag Manager homepage and click “Sign in to Tag Manager” button.
Next, click “Create account”
You will be taken to the account creation page where you will be asked to complete information entries.
Nothing special, after filling in the information, click “Create” button.
After, you will be asked to read and accept Google Tag Manager terms of service. Now Click “I Accept” then arrive at your GTM dashboard.
2. Set up the Google Analytics 4 Configuration tag
Create a GA4 Configuration tag
In your GTM dashboard click “Add a new tag” then you will see below screen
First choose tag configuration when the window that opens select GA4 Configuration.
Then you will see as below screen
Now, go back to GA account go to the data stream section get the Measurement ID then enter it into the input section.
In the “Triggering ” section fill in the scope where you want to place the tag on your site. Most people choose all pages but you may want exclude certain pages, such as Privacy Policy, Terms & Conditions, login…
Now, save your tag then publish your GTM container to push it live.
Create a GA4 event tag
Do the create new tag again, but this time we will choose the tag type as “Google Analytics: GA4 Event.”
In Configuration Tag, select your Google Analytics: GA4 Configuration tag created in previous step.
In Event Parameters choose “Built-In Variable…” then you can choose one of them then enter the Event Name.
then Create a trigger and click “save”
Finally click submit to put the updates live then press prevew to check if the tag is active. If you see the image below, everything is ok.
Do you think setting up GA4 and GTM is easier than you imagine? But to take full advantage of the benefits GTM and GA4 bring, you still need to learn a lot of analysis techniques. If you are interested in learning and have time for that, we will explore together in the next articles. Contact us if you face any problems during the installation process.