Google Tag Manager
Please note that this document is a draft and still not finalized.
This page describes how to configure Tag Manager accounts to configure Google Analytics
Google Tag Manager (GTM)
Google Tag Manager (GTM) , is a free tag management system that allows you to manage and deploy marketing tags (snippets of code or tracking pixels) on your website (or mobile app) without having to modify the code.
GTM gives you the ability to add and update your own tags for conversion tracking, site analytics, remarketing, and more. There are nearly endless ways to track activity across your sites and apps, and the intuitive design lets you change tags whenever you want.
Tag Manager Accounts
A Tag Manager account represents the topmost level of organization. Typically, only one account is needed per company. A Tag Manager account contains one or more containers.
GTM Tags
Tags are segments of code provided by analytics, marketing, and support vendors ( EX: Google Analytics) to help you integrate their products into your websites or mobile apps. With Google Tag Manager, you no longer need to add these tags directly to your projects. Instead, you configure and publish tags and how they fire from within the Tag Manager user interface.
Container
A container consists of multiple tags and rules to govern them. There are specific container types that may be used for:
Websites
AMP pages
Android apps
iOS apps
Running Tag Manager on a server
How to set up Tag Manager for Mobility Web
GTM is used only for the web application.
1. Create a new Account
When you create a new account, you will walk through the steps to set up a new container.
In Tag Manager, click the Accounts tab > Create account.
Enter an Account Name and select the Country for the account.
2. Import the Container
Google Tag Manager containers can be exported as JSON. Exported containers can be compared, modified, shared, stored in a version control system, and imported back into Tag Manager.
In the top navigation, click Admin.
In the Container section, click Import Container.
Click Choose container file and select the file that you would like to import.
Select if you would like to add the imported file to a new or existing workspace.
To add the file to a new workspace:
Under Choose workspace, click New.
Enter a title and description for your workspace.
Click Save.
To add the file to an existing workspace:
Under Choose workspace, click Existing.
Select the desired workspace.
Select Overwrite or Merge.
Overwrite will remove all your existing tags, triggers and variables, and will replace them with those in the imported container. A new container version will be created before the import.
To Merge, select whether you want to overwrite or rename conflicting variables, triggers and tags.
Overwrite conflicting tags, triggers, and variables: If a variable, tag, or trigger in the new container has the same name but the contents are different, overwrite the old one with the new one. (If the contents are the same, there is no conflict.)
Rename conflicting tags, triggers, and variables: if a variable, tag, or trigger in the new container has the same name but the contents are different, rename the new one. (If the contents are the same, there is no conflict.)
Click Continue. The preview dialog shows how many tags, triggers and variables will be added, modified, or deleted. Click View Detailed Changes to see a list of all the items that will be affected.
Once you are satisfied with the changes that will be made, click Confirm.
Publish the changes.
The default container script can be found in the JSON format from here.
3. Adding Google Analytics Tracking into GTM
For this you should have an account on Google Analytics.
1.Copy the Google Analytics Tracking ID from the Google Analytics Dashboard
Go to analytics.google.com > select the account you want to track > Admin > Tracking Info > Tracking Code
Copy the UA-XXXXXX-XX code.
2.Update the GA PROD variable value with their google analytics tracking id by Tag Manager Dashboard -> Workspace -> Variables -> GA PROD -> Tracking ID
Copy the UA-XXXXXX-XX code you got from Google Analytics dashboard on the ‘Tracking ID’ field of the ‘GA PROD’ variable'.
4. Send the GTM ID to the BRP Team.
1. In your tag manager workspace, near the top of the window, find your container ID, formatted as GTM-XXXXXX.
2. Copy the GTM--XXXXXX container number.
3. Update the GTM id in the back office (googleTagManagerID
) to initialize GTM configurations in web app.
Events that are possible to track
The data you see in your reports comes from events that trigger as users interact with your website and/or app. For example, a page_view event triggers when a user views a page on your site.
The following table shows a list of events that have been implemented for project ‘Mobility’ for both web and mobile applications:
How to Install Meta Pixel with Google Tag Manager (Facebook Pixel)
Meta Pixel is an analytical tool that allows you to track your website visitors activities. It is a piece of code that helps identify Facebook and Instagram users and see how they interacted with the content on your website (page views, product views, adding to cart, starting checkout, purchases, etc).
1. Add Facebook Pixel Custom Template
1.In Google Tag Manager, go to Templates > Tag Templates > Search Gallery and in the search field, enter Facebook.
2. Click on it and add it to your Workspace. A new template will appear in the Tags > New > Custom section. You can reuse it multiple times for tags in the same container.
2. Get the Meta Pixel ID
Go to the Facebook Business manager account and get your Pixel ID.
1.Open Business Settings in Business Manager.
2. Choose your business.
3. Click on Data Sources and you will see your Pixels. Your Pixel ID is in parentheses right under the name.
3. Set up a Constant Variable for the Pixel ID
To make things more optimal, you could create a GTM Constant variable that stores your Meta Pixel ID. Then you could reuse the same variable every time you need it. Once you need to change the Pixel ID, you’ll need to do that just once in the constant variable.
1.In Google Tag Manager, go to Variables > User-defined Variables > New > Constant and paste your Meta Pixel ID.
2. Save the variable here as Constant – Facebook Pixel ID.
4. Set up the Meta Pixel Pageview Tag
1.In Google Tag Manager, go to Tags > New > Facebook Pixel. Enter the settings you see in the screenshot below.
2. In the Facebook Pixel ID(s) field, enter the insert the name of the constant variable that you created in the above step that carries your Pixel ID in the Facebook Pixel ID field. This field lets Google Tag Manager know the exact Meta ad account to send this data.
3. Set the tag to fire on All Pages.