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
Sign in with your Google account.
Click on Start Measuring.
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.
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.
Read and accept the terms of service.
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).
Enter the URL of your website, a stream name, and click on Create Stream.
Note down the Measurement ID of your webstream as shown below.
Copy this Measurement ID. Later, this ID will be used while creating a GTM tag.
Creating a GTM Account
Click your property name on the top-left corner as shown in fig. 12
Go to Tag Manager (2nd icon) and click on Get started.
You will be redirected to tagmanager.google.com. Click on Create Account.
Add a descriptive name to your new GTM account and select your country.
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.
Read the Terms of Service and click Yes (if you agree to those terms).
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.
Integrating GTM with Fynd Platform
On Fynd Platform, go to the Settings page of your sales channel and click on Integration.
Click on GTM.
In the API Key, paste the container ID. Use the toggle button to enable this integration, and click Save.
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.
Use Ctrl+F and type gtm. If the container ID is visible in your page source, your GTM integration is successful.
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.
Enter a tag name and click the edit icon to view the available tag types.
Choose Google Analytics: GA4 Configuration.
Enter the Measurement ID of your data stream (copied earlier).
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.
Page View is the most common trigger, you can either choose it or click the + icon on the top-right to view more triggers.
Page View trigger is added successfully. You can add more triggers if required.
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**.
Add a version name and description. Click Publish.
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.
Since there were zero/no users, let's go to the data stream (your website).
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.
If you visit the website from your mobile browser, Google Analytics will show the corresponding result.
Scroll down the page to view the type of events detected through your GTM tag.
You can continue experimenting with Google Analytics along with GTM tags and other triggers to obtain in-depth user behaviour on your website.