GTM-GA4
Introduction
Google Tag Manager (GTM) helps you to add a snippet of information to your website. It is generally used by digital marketers and analysts for monitoring user behaviour, without having to edit the actual code.
If you want to know how to use Univeral Analytics (UA) instead of GA4, click here
Creating a Google Analytics (GA4) Account
Go to Google Analytics
Figure 1
Sign in with your Google account.
Figure 2
Click on Start Measuring.
Figure 3
Enter an account name. Use a descriptive name, so you can easily tell what this account is used for when you see it in the list of accounts.
Figure 4
Enter a property name. It's recommended to use the name of your website or app, so you can easily identify what this property is used for.
Fill in all other business details and click on Create.
Figure 6
Read and accept the terms of service.
Figure 7
Now that you have successfully created your Google Analytics account, you can set up a data stream (a source of data, e.g., your existing website or mobile app).
Figure 8
Enter the URL of your website, a stream name, and click on Create Stream.
Figure 9
Note down the Measurement ID of your webstream as shown below.
Figure 10
Copy this Measurement ID. Later, this ID will be used while creating a GTM tag.
Figure 11
Creating a GTM Account
Click your property name on the top-left corner as shown in fig. 12
Figure 12
Go to Tag Manager (2nd icon) and click on Get started.
Figure 13
You will be redirected to tagmanager.google.com. Click on Create Account.
Figure 14
Add a descriptive name to your new GTM account and select your country.
Figure 15
Enter a container name and target platform. In this example, we will analyze user behaviour on desktop and mobile web. Therefore, let's select Web as the target platform.
Figure 16
Read the Terms of Service and click Yes (if you agree to those terms).
Figure 17
You have successfully created your GTM account. Note down your Container ID as shown below. This container ID will be used to integrate GTM with Fynd Platform.
Figure 18
Integrating GTM with Fynd Platform
On Fynd Platform, go to the Settings page of your sales channel and click on Integration.
Figure 19
Click on GTM.
Figure 20
In the API Key, paste the container ID. Use the toggle button to enable this integration, and click Save.
Figure 21
It may take up to 2 minutes for your GTM code (container ID) to reflect in your page source.
Go to your website, then right-click and select View Page Source.
Figure 22
Use Ctrl+F and type gtm. If the container ID is visible in your page source, your GTM integration is successful.
Figure 23
Creating a GTM tag
Once the GTM code is integrated with Fynd Platform, you can start creating GTM tags.
From the left-panel, go to Tags and click New.
Figure 24
Enter a tag name and click the edit icon to view the available tag types.
Figure 25
Choose Google Analytics: GA4 Configuration.
Figure 26
Enter the Measurement ID of your data stream (copied earlier).
Figure 27
You have seen the process of obtaining a Measurement ID in the section: Creating a Google Analytics (GA4) Account
Now, let's choose a trigger which will fire your new tag.
Figure 29
Page View is the most common trigger, you can either choose it or click the + icon on the top-right to view more triggers.
Figure 30
Page View trigger is added successfully. You can add more triggers if required.
Figure 31
If you are adding a trigger, give it an appropriate name and choose the trigger type.
Choose any trigger from the list. In this example, we will be using only the Page View trigger though.
8. Click **Save**.
Click Submit.
Figure 35
Add a version name and description. Click Publish.
Figure 36
Versioning helps to maintain records of your tags, which will help you to revert to this version in the future.
Using Google Analytics to view GTM output
In the left-panel of your Google Analytics account, click on Realtime. Here, you can view the real-time data of users on your website. There's a graphical, numerical, and geographical representation of desktop and mobile users.
Figure 37
Since there were zero/no users, let's go to the data stream (your website).
Figure 38
Your GTM tag was fired by the Page View trigger after visiting the website. Google Analytics detects a desktop user, and it also points to the geographical location of the user.
Figure 39
If you visit the website from your mobile browser, Google Analytics will show the corresponding result.
Figure 40
Scroll down the page to view the type of events detected through your GTM tag.
Figure 41
You can continue experimenting with Google Analytics along with GTM tags and other triggers to obtain in-depth user behaviour on your website.