Beginner to Advanced Google Tag Manager Training [Free]

Home > Guides

What is a Tag Management System

  • Tag Management System (TMS) is any system that helps you manage all your emarketing JavaScript codes that have been implemented on your website (or mobile app) by installing all the tags in the TMS rather than in your website code.

  • When you want to track the behavior of your website visitors, you paste certain JavaScript codes like for Google Analytics, Google Ads, Facebook Pixel etc. to transfer the data from your website to these services so you can go back to those services and understand your users and campaigns.

  • A Tag is any piece of third-party JavaScript code that is provided by a third party product or service to you, in order to collect the data from your website and send the data back to the product or service. If you use Google Analytics for your website, that is a tag. If you use Adsense to show ads on your website, that is a tag.

  • Using a Tag Management System (TMS) like Google Tag Manager (GTM); instead of placing several javascript codes for different third party services, all you need to do is to place one JavaScript code - i.e., the Javascript code of Tag Management System (TMS), and manage all the other Javascript codes (tags) of your website using your TMS.

  • Using a Tag Management system, you no longer need to add third party tags manually into your code. You can create these tags through the Tag management system and specify when they should fire.

 

Pro Tip - Tag Management is not really about managing your e-marketing Javascripts or just an external Javascript Publishing engine. TAG Management System is actually about managing your DATA.

What is Google Tag Manager?

Google Tag Manager logo

  • Google Tag Manager is one of the Tag Management Systems that you can use to manage the implementation of e-marketing javascript codes of your website or mobile app.

  • Instead of pasting several Javascript codes to send your website data to third-party services, you can only paste Google Tag Manager Javascript code, and add all the other e-marketing Javascripts codes from your Google Tag Manager Dashboard.

  • Other notable TMSs

Advantages of Using a Tag Management system

 

  • Isolate Marketing tags from application code

TMS helps you get rid of all the clutter and messy implementations accumulated on your code files, and presents you with one place where you go to add, remove, update or monitor all your website or mobile marketing tags. All your marketing tags are managed from one place - the TMS

  • Independency from IT Department - As a digital marketing team, you can install a new tag without the need to wait for the IT team to make changes in the code for you. TMS also has many built-in triggers that can be used without much need to write a piece of code. You have all your controls from your Google Tag Manager dashboard where you can publish any changes when you want, instantly. (However, some time you do need to tell IT to code in order to get some data from the website)

  • Reusing triggers - Let’s say you defined an Event trigger for Google Analytics which fires every time a user clicks "Call Now". You can use this same Event trigger for Google Ads as a conversion. If you did not use a TMS, you would have had to manually code each scenario for each service. (If you didn’t quite get this, that’s okay. You will learn about triggers later in this article.)

  • Page Speed improved - Google Tag Manager is an asynchronous tag - when it loads, it does not block your resources like html, javascripts or stylesheets to render. It also makes sure to load other tags that are a part of Google Tag Manager implementation to load asynchronously. If any of your tags takes time to load - it will not block other tracking tags and will not block your page render. So when you use Tag Manager, you have one big Page Speed optimization related to tags taken care of automatically.

Why Tag Management is DATA Management, not Javascript code management

If you have a website or an app, you will two goals for your website or an app.

  1. Get users so they can use your website or app (By Advertising, SEO and ASO)

  2. Once you get them, make them fulfill the ultimate goal. Like ...

    1. Buy a product or service

    2. Click on an Ad on the website

    3. Fill up a form and give their details

    4. Call you

    5. Signup for your monthly Newsletter

    6. Play a Video and watch it completely

 

Collecting Behavior Data - In order to achieve your ultimate goal from your website, you need to understand your users first. You cannot just create an advertisement campaign on instagram, and later wonder why no one bought your product.

 

To understand your users and what they do on your website (User Behavior), you may start off by implementing Google Analytics to your website by pasting a Javascript code. Now you are sending your website traffic data to Google Analytics so you can dive deeper into understanding what the user is doing on your website. You may learn about any issues and may improve your website using this data.

 

Collecting Ecommerce/Remarketing data - Next, you might plan to run a Facebook Ad in order to get users to your website. Every click on your ad costs you money. You want to know how many users came from Facebook and what was the behaviour of users that came from your Facebook ad campaign. How many users from Facebook Ad campaign fulfilled your ultimate goal(s) on the website? Was Facebook campaign a good ROI? To know this, you need to provide data to Facebook. So Facebook gives you Facebook Pixel - another piece of Javascript code that you need to paste to your website.

 

If you make money from showing ads on your website using Google AdSense or Ezoic, you paste their Javascript code so they can show the ads to your website and track how many people clicked on them so they can pay you accordingly.

 

If you are placing an ad on Google, and want to track and optimize your ad campaign, Google Ads will give you their own Javascript code that you need to paste on your website.

 

Ideally you will have a bunch of Javascript codes for several third party products and services to send and receive DATA related to user behavior, e-commerce performance or remarketing data.

 

When you use a Tag Management system, it provides its own Javascript code. However, when you use a TMS -  all you do is paste one Javascript code throughout your website - the TMS javascript code. All the other Javascript codes are created and managed from your TMS and they are called “Tags”. TMS helps you in adding and managing javascript and implementation of the Javascript provided by different products and services - but TMS is not just a Javascript publishing engine.

 

Having so many tags on your website can make it very cluttered and difficult to manage, affecting your page speed and even crashing your whole website if not implemented properly. TMS comes to the rescue.

 

The main goal of using TMS is to manage your WEBSITE DATA more efficiently and effectively.

Creating a Measurement Plan

  • Before you implement Tag Management, you need to build a solid measurement plan for the business - metrics and dimensions that are needed to be tracked for analysis.

  • Once you have clearly defined you plan for measurement - it will guide your tag implementations.

  • How to manage already existing tags on your website more effectively on GoogleTag Manager?

  • What static and dynamic values you want to pass from your website.

Ask these questions

  1. What is the function of the tags that you want to install?

  2. What data needs to be passed to the marketing vendor of this tag?

  3. Are there any exceptions? Should the tag only fire when certain conditions are met?

What are the KPIs (metrics) that need to be tracked?

  • Users and Sessions metric can give you the data of how many new and returning visitors you have. So you will install Google Analytics tag to collect these metrics.

  • If you are a content website, you would want to know how much Time

  • If you are a website that allows Booking a hotel, you can decide that   a custom metric and call it Booking Conversion Ratio, which would be the total number of users divided by the total number of users who actually made the bookings.

What are the Segments (dimensions) that need to be tracked?

  • Traffic Sources dimension can be used to understand from where the users are coming to our site (Google, Social Media or maybe an ad campaign)

  • If you are a travel site, you can decide that segmenting the data by creating a custom dimension Trip Country which records the destination country for which the users booked for - can be a useful piece of data to analyse. You can also decide to segment the data by including a tracking for Demographics - Age, Gender and Nationality of the user who booked flights on your website.

 

Once you have decided on a measurement plan for your business and defined all the metrics and dimensions that you need to collect data for - you will install the Google Analytics - PageView tag on your GTM.

 

Your data requirements to map back to your overall business goals so you know you are analyzing the appropriate data. Developing a Tag implementation plan helps you figure out what tags to create in your GTM and what data needs to be passed for data analysis.

An example of Tag Implementation Plan

Measurement Plan

Metrics / Dimensions

Tagging

Strategy

Data Layer Variable

Analytics

Data Received

Users + Sessions

Install GA “Page View” tag to fire on every page.

--

Users and Sessions metric

Traffic Sources

Install GA “Page View” tag to fire on every page.

--

Traffic Source dimension

Customer Demographics

Install GA “Page View” tag to fire on every page.

--

Demographics dimension

Trip Country

When user clicks “Details” button, use user-defined variable to capture trip location name and pass into Analytics Custom Dimension.

{{tripCountry}}

Custom Dimension

(Trip Country)

Revenue

On “thank you” page, use javascript to capture trip price from URL and use user-defined variable to push that price into the Data Layer and pass into Analytics Custom Metric to calculate revenue.

{{tripValue}}

Custom Metric

(Total Revenue)

Avg Revenue

On “thank you” page, use javascript to capture trip price from URL and use user-defined variable to push price into the Data Layer and pass into Analytics Custom Metric. Divide by number of users or sessions to calculate revenue.

{{tripValue}}

Custom Metric

(Total revenue / Users or Sessions)

Booking Conversion Ratio

Use built-in variable to fire an event every time the “Book Now” button is clicked to capture trips purchased. Divide number of trips purchased by users or sessions to obtain conversion rate.

{{ClickClasses}}

Event

(Trips Purchased / Number of Users or Sessions)



 

Structure of Google Tag Manager

  • GTM Administration happens at the account level.

  • One account can be used to manage one or more websites.

  • If you are an agency, you can have multiple GTM accounts where each account manages multiple websites - all connected to one single user’s Google account. For example, all your client’s can have their own GTM accounts, and everyone of them can grant access to your google user account.

Tag Manager structure

  • An administrator of a GTM account can offer different levels of access permissions to a user account.

GTM access to users

  • Each GTM account has at least one Container. A container contains the tags and triggers that determine when they should be fired or collect data.

GTM Container

  • You have one container for each web domain. However, you can use just one container for two websites as well - for cross-domain tracking.

Installing Google Tag Manager on your website

 

To get started with using GTM, you will have to place a javascript code (called container) on every page of your website.

  1. Go to Google Tag Manager and make sure you are signed in to the account you want associated with GTM.

  2. Add an Account Name. You can have several website domains and containers within this account so choose a name that is most reasonable to you.

  3. Add a Container Name. Every account has at least one container.

  4. Click Create

  5. Accept the Terms and Conditions

  6. You will be provided with two codes to be pasted on all of the pages of your website

    1. one to be pasted in your <head></head> section of the website

    2. Another to be pasted just after the <body> opening tag.

 

Once you have pasted the codes as advised - you just finished adding the one and only 3rd party Javascript code that you will ever need on your website.

 

Next, all you will do is create Tags and Triggers.

TAGS - Installing and managing Tags in GTM

First, we will install a standard tag - the Google Analytics tag - into the GTM.

Installing Google Analytics tag in Google Tag Manager

  1. Go to Tags and click on New

  2. Enter a name of the tag (example: “GA Tag - Website Name”)

  3. Choose Tag type “Google Analytics - Universal Analytics

  4. Track Type - Page View because we want to load Google Analytics tag on every page view

  5. Google Analytics Setting -> New Variable -> Paste your Google Analytics TrackingID. You just created a User-Defined Constant variable in your GTM account that has stored your Google Analytics TrackingID. You can reuse this variable in future tags if needed. You can also change this constant value and it will reflect to all the tags in which it is being used.

  6. Triggering - Select All Pages since we want this Google Analytics tag to fire on every page view of the website.

  7. Save

 

You just created your first tag. But you have to click on Publish to publish the tag. Before publishing, make sure you have setup the tag correctly.

You can do that by clicking on “Preview” instead.

  • Preview Mode makes your browser go into Preview mode.

  • after you click on Preview in GTM, just open a new tab and go to your website

  • You will see a debugging window appears at the bottom which should show the details of your fired Google Analytics tag if you have implemented everything correctly.

Click Publish.

 

You just Published your GA Tag to your website.

Note: If you already had Google Analytics tracking code snippet added to your website earlier, you don’t need it anymore. Magic!

Remove it from your website code to avoid Google Analytics files to be loaded twice.

VARIABLES in Google Tag Manager

  • Variables in GTM are values that are set so they can be used when we are defining Tags and tag Triggers.

  • The value of a Variable is used in Triggers to define filters/conditions that need to be met before a tag is fired.

  • Variables are used in Tags to capture dynamic values.

  • There are two types of Variables in GTM.

    • Built-in Variables - pre-created and non-customizable.

    • User-Defined Variables

Enabling built-in variables in GTM

There are about 49 pre-defined pre-created built-in variables with every container of your Google Tag Manager account. Out of all these built-in variables, only 4 most commonly used variables are enabled for use.

 

To enable more built-in variables for a container:

  1. Click Variables in the left menu.

  2. In the Built-In Variables section, click Configure.

  3. Enable or disable variables using their corresponding checkboxes.

Overview of some of the built-in variables in GTM

Built-in variables in GTM can be categorized into 9 categories. We will discuss some of them in each category.

  1. Clicks

    1. Click ID: Accesses the gtm.elementId key in the dataLayer, which is set by Click triggers. This will be the string value of the id attribute on the DOM element that was clicked.

    2. Click URL: Accesses the gtm.elementUrl key in the dataLayer, which is set by Click triggers.

  2. Errors

    1. Error Message: Accesses the gtm.errorMessage key in the dataLayer, which is set by JavaScript Error triggers. This will be a string that contains the error message.

  3. Forms

    1. Form Classes: Accesses the gtm.elementClasses key in the dataLayer, which is set by Form triggers. This will be the string value of the class attribute on the form.

    2. Form ID: Accesses the gtm.elementId key in the dataLayer, which is set by Form triggers. This will be the string value of the id attribute on the form.

  4. History

  5. Pages

    1. Page Hostname: Provides the hostname portion of the current URL.

    2. Page Path: Provides the path portion of the current URL.

    3. Page URL: Provides the full URL of the current page.

    4. Referrer: Provides the full referrer URL for the current page.

  6. Scroll

    1. Scroll Depth Threshold: Accesses the gtm.scrollThreshold key in the dataLayer, which is set by Scroll Depth triggers. This will be a numeric value that indicates the scroll depth that caused the trigger to fire. For percentage thresholds, this will be a numeric value (0-100). For pixels, this will be a numeric value that represents the number of pixels specified as the threshold.

  7. Utilities

    1. Container ID: Provides the container's public ID. Example value: GTM-XKCD11

    2. Random Number: Returns a random number value.

  8. Videos

    1. Video Current Time: Accesses the gtm.videoCurrentTime key in the dataLayer, which is an integer that represents the time in seconds at which an event occurred in the video.

    2. Video Percent: Accesses the gtm.VideoPercent key in the dataLayer, which is an integer (0-100) that represents the percent of video played at which an event occurred.

    3. Video Status: Accesses the gtm.videoStatus key in the dataLayer, which is the state of the video when an event was detected, e.g. 'play', 'pause'.

    4. Video Title: Access the gtm.videoTitle key in the dataLayer, which is set by YouTube Video triggers. This will be the title of the video.

    5. Video URL: Access the gtm.videoUrl key in the dataLayer, which is set by YouTube Video triggers. This will be the URL of the video, e.g. ‘https://www.youtube.com/watch?v=gvHcXIF0rTU’.

    6. Video Visible: Access the gtm.videoVisible key in the dataLayer, which is set by YouTube Video triggers. This will be set to true if the video is visible in the viewport, and false if it is not (e.g. below the fold or in a background tab).

  9. Visibility

    1. Percent Visible: Accesses the gtm.visibleRatio key in the dataLayer, which is set by Element Visibility triggers. This will be a numeric value (0-100) that indicates how much of the selected element is visible when the trigger fires.

    2. On-Screen Duration: Accesses the gtm.visibleTime key in the dataLayer, which is set by Element Visibility triggers. This will be a numeric value that indicates how many milliseconds the selected element has been visible for when the trigger fires.


 

Check Google documentation for complete list of available built-in variables and explanations

 

Creating a user-defined variable in Google Tag Manager

User defined variables are constant variables that can be created by us to be used conveniently whenever we need them.

Let’s create the most common user-defined GTM variable which stores our Google Analytics TrackingID

  1. Go to Variables

  2. Under User-Defined Variables, click New

  3. Give your variable a name (ex. GA TrackingID - Website Name)

  4. Choose variable type - Constant (since this value will contain our GA tracking ID which does not change)

  5. Copy your Google Analytics TrackingID from your Google Analytics Admin > Property Settings and paste the value here.

  6. Click Save

 

You can now use this user-defined constant variable throughout different tags wherever you will be prompted to provide Google Analytics property Id.

 

Types of user-defined variables in GTM

There are about 18 different types of user-defined variables that you can create to be used in tags and triggers. These variables can be categorized into 5 categories. We will discuss few common ones here:

 

  1. Navigation

    • URL - The URL components you can choose from are: Full URL, Protocol, Hostname, Port, Path, Filename Extension, Query, and Fragment. Generally, this type of variable gets the URL of the current page the user is on (retrieved from document.location). Using this user-defined variable,you can specify an alternate URL Source to advise GTM to use another javascript variable as the source of the URL value.

  2. Page Variables

    • 1st Party Cookie - The value of this variable is the 1st party cookie with the name of the domain that the user is currently on. If more than one cookie with same name is deployed on the same domain, the first value will be chosen. This value is the same is if you had called document.cookie from within a page and chosen the first result.

    • Custom Javascript - The value of the variable is set to the result of a JavaScript function that you specify. You write an anonymous Javascript function that should return a value. For example, a custom JavaScript variable can be created to convert all instances of the predefined {{url}} variable to lowercase:

function ()

{

 return {{url}}.toLowerCase();

}

    • Data layer - It is just a Javascript object that can be used to hold some data that you push to this object. The value is set when data is pushed to the data layer via the dataLayer.push() call of Javascript:

 

dataLayer.push({"Data Layer Name": "value"}).

 

You can use information in Data Layer object to decide when a tag should fire or just transfer the Data Layer information to third party applications like Google Analytics.

You can specify how Tag Manager interprets dots (".") in the key name:

Version 1: allow dots in key names. For example, for dataLayer.push("a.b.c": "value"), interpret the name of the key as "a.b.c" (i.e. {"a.b.c": "value"}).

Version 2: interpret dots as nested values. For example, interpret dataLayer.push({"a.b.c": "value"}) as three nested levels: {a: {b: {c: "value"}}}.

Need to understand more? Don’t worry. It is explained in simple english and with good examples later.

    • Javascript variable - The value is set to the global JavaScript variable you specify. If the value required was not set up in the data layer, and it's not visible in the DOM, it might be possible to get the value from a JavaScript variable. Use this variable type if you can find the value in the page's source code as a global JavaScript variable.

 

  1. Page Elements

    • Auto-Event variable - Captures info of an item that triggered an event, like Element ID, Element URL,Element Type (IMG, A,BUTTON), Element Target (eg. _blank) etc.

    • DOM Element - Value is text of the DOM element or the value of the specified element’s attribute (if the optional attribute name is set). Use this variable type if you can find its desired value in the DOM.

    • Element Visibility

 

  1. Utilities

 

    • Constant - The value is set to the string you provide in GTM.

    • Google Analytics Settings variable - to configure and share common GA settings in multiple tags.

    • Lookup table - Used when the value of a variable depends on the value of another variable. For example, if {{url}} contains thankyou.html, then set {{conversionId}} to 12345

    • RegEx table - Similar to lookup table, with the ability to run regular expressions for matching.

 

  1. Container Data

    • Container ID - Returns the ID of the Tag Manager container, e.g. 'GTM-101010'.

 

Check Google documentation for a full list and explanations.

TRIGGERS - What are Triggers in GTM?

Short Answer: Triggers fire Tags in response to an Event on the website. An event is a form submitted, or a video played. You can create a Trigger which listens to such events and fire a specific tag when an event takes place.

 

  • A GTM container is placed on every page of the website and is fired on every page of the website pageview. When you add different tags to your container, you don’t necessarily fire all the tags every time. You may want to fire a tag only when a specific condition is met - for example, when a user clicks on a link, or plays a video.

  • Each tag must have at least one trigger to fire.

  • A Trigger is basically a rule or a condition that needs to be met before a tag can be fired. For example, Fire a tag only when the url equals checkout.html

GTM Triggers

 

  • Triggers are made up of

    • Variables

      • Built-in - Already provided like {{Page Path}}, {{Click ID}} etc.

      • User-defined - The ones you create, like {{tripCountry}} and {{tripValue}}

        • User-defined variables have a type. What you choose depends on what value you are tracking.

          • 1st Party Cookie

          • Auto-event variable

          • Constant

          • etc.

    • Operators - Defines the condition between variable and value. Example: equals, contains, doesn’t contain

    • Values - Any value, a string, a url.

  • If a trigger is set to Fire a tag only when the url equals checkout.html, then in this example:

    • URL is a variable

    • equals is an operator, and

    • checkout.html is the value.

 

GTM Triggers Example

 

  • You can one or more conditions to one trigger - which means all the conditions must be true before the attached tag fires.

GTM Triggers multiple conditions


 

Setting up cross-domain tracking in your GTM account

  • Let’s say you have two websites and you want to view user data from both websites in one Google Analytics report, you can achieve this by using cross-domain tracking using Tag Manager and Universal Analytics

  • You may consider having data from two of your domains in one Google Analytics report if your users navigate from one domain to another.

  • All you have to do is create two constant user-defined variables, {{gaDomain}} and {{gaCrossDomains}} and add them to “Fields to set” and “Cross-domain tracking” variables in your Google Analytics implementation of Google Tag Manager.

  • {{gaDomain}} will write cookies to the highest-level domain by default to ensure data is maintained and not lost across sub-domains.

  • {{gaCrossDomains}} lets you reference a list of domains all at once

 

  1. Go to Variables

  2. Edit the Google Analytics TrackingID variable that you created earlier.

  3. Click More Settings>Cross Domain Tracking

  4. Type comma-separated list of domain names that you want to include for this Google Analytics tag variable (example2.com,example3.com,example4.com)

  5. Save

  6. Publish

Once you publish, you will be able to use your GA Page View tag to track across different domains. You can see realtime traffic from each of the domains that you are tracking.

Data Layer in Google Tag Manager

  • It is just a Javascript object that can be used to hold some data that you push to this object. The value is set when data is pushed to the data layer via the dataLayer.push() call of Javascript:

  • You can use the information in Data Layer object to decide when a tag should fire or just transfer the Data Layer information to third party applications like Google Analytics.

  • Data Layer is nothing but a Javascript object (key-value pair) that holds some data (a custom event data or any variable to be passed from your website)

  • It is an alternate method to collect data from your website and send it to third party applications or use it’s data in your triggers to fire tags.

  • There are two ways in which you can capture data using Google Tag Manager.

 

  1. Data collection through DOM or Browser- extracting the data from your site’s source code or from a browser.

  2. Data collection through Data Layer (Recommended) - Does not extract data from the source code of your website thereby preventing any dependencies to the code. It is a method which  isolated from your source code to pass data from your website.

 

Adding a Data Layer for website data collection

  • To set up your Data Layer , create an empty object with the name dataLayer - and you have to create this empty object in the <head> section of your webpage - above your Google Tag Manager container snippet.

<script>

 dataLayer = [];

</script>

<!-- Google Tag Manager -->

...

<!-- End Google Tag Manager →

  • Once you have defined an empty dataLayer object, you can push your values to this object later in your scripts.

 

Very Important Note: If you place your Data Layer object after the Tag Manager snippet, your Tag Manager might malfunction and won’t be able to access any defined variables in your Data Layer object.

 

  • Now, you can add key-value pairs to this empty dataLayer object with the data you want to pass to Google Tag Manager.

<script>

 dataLayer = [{

   'userName': 'bob',

   'interests': 'spirituality'

 }];

</script>

  • You somehow know that a user named “Bob” just signed in to your website and he is interested in all things “spirituality”. You can pass this information to your Tag Manager and use this information to make decisions of which tag to fire. Maybe you have a tag that starts to show spirituality related ads to Bob? Or maybe you just want to send the information to Google Analytics to make use of Google Analytics User-ID feature to attribute the session to an actual person named “Bob” and record everything bob does on your website - for your analysis.

 

Time to appreciate Tag Management Systems - Without Google Tag Manager, for you to know that Bob signed in and he is interested in the topic of spirituality, you would have had to manually code these updates to your Google Analytics tag and then redeploy it on every page of your website. When you are using Tag Manager - imagine Tag Manager as your TV remote control. You can easily add these tag changes by simply modifying your Google Analytics tag configuration by creating a trigger.

2 ways of pushing data to Data Layer

 

There are two ways in which you can implement a data layer in Google Tag Manager.

 

  1. Pre-populating values in Data Layer

    Data Layer in GTM - Prepopulate values

  • When page loads, you set the values you want and provide it to the Data Layer.

  • Example: You may have different category of pages on your website. If a user come to a particular category page, you may want to track all the users coming to this particular category. To achieve this, you will create a Data Layer variable - call it {{productCategory}} - whose value you will take from the page and set to the Data Layer variable. You may also want to track the product name - call it {{productName}}.

   

<script>

    dataLayer     =    [{

            productCategory: 'Headphones',

            productName: 'Beats Wireless HD Black'

            }];

</script>

  • Why would you want to collect these values from website? Maybe to fire a tag when these values are true. Let’s take a remarketing example. Once you know a visitor checked out this product, you can save this information and use it when the same visitor returns back to your website later. You can create a trigger with the above key-value pairs and push this information to your site to show recommended pages that match the above Category and Product - to suggest more relevant products which creates a unique experience for every user.

  • Why would you use this approach of pre-populating the Data Layer variable? Because you already know the values for the keys that you need to record in the Data Layer variable. You don’t have to wait for any user action, an event or a page load to take place. The kind of data you want to collect from your website is already available when the page is requested, so you can just pre-populate the Data Layer variable with the information you want collected.

 

  1. Pushing values to Data Layer using Javascript .push

Data Layer in GTM - javascripr push

  • You push values from your website directly to the Data Layer using Javascript .push method.

  • This method allows you to push any data to the Data Layer irrespective of what tags are loaded on the page.

  • Example: If your users can add multiple products to their cart just by clicking “Add to Cart” on multiple products - every time they add an item to the cart, you can record this information and push it to the Data Layer.

   

    <script>

    dataLayer.push({

            productCategory: 'Headphones',

            productName: 'Beats Wireless HD Black'

            });

</script>

 

  • Why would you want to collect these values from website? Maybe to send it to a third-party application like Google Analytics to track cart abandon rate, how many people are adding things to cart vs how many are actually checking out successfully. Awesome stuff! Beautiful data!

  • Why would you use this approach of using Javascript .push function to populate the Data Layer variable? Because you do not know the values for the keys that you need to record in the Data Layer variable - it is dependent on an action that is performed by the user after the page is loaded. You cannot pre-populate the kind of data that you are wishing to record here. So you use the Javascript .push function to push some data once a certain event takes place.

Making use of HTML Event handlers

  • You may wish to record an event when a user does something on your website - like fill a form or click a button. Apart from passing values like the text of the button, the page on which the button was pressed etc, you may also want to record this action as an event.

  • As we have seen so far, you are using the Data Layer object to transfer data from your website and you are using your own custom keys in the key-value pair.

  • Data Layer offers a special variable called event - use this to pass an event - when an event takes place that you want to record.

  • You guess it right. We will push this information to the Data Layer using the .push Javascript function.

 

dataLayer.push({'event': 'event_name'});

where event_name is the string for you to define what event took place.

  • Example: When a user fills up a form and clicks the submit button, you want to push an event to record that your website form was filled and a lead was generated.

 

<a href="#" name="submit" onclick="dataLayer.push({'event': 'lead-created'});" >Send you Requirements</a>

Making sense of Data Layer

  • Google Tag Manager is an asynchronous tag - when it loads, it does not block your resources like html, javascripts or stylesheets to render. It also makes sure to load other tags that are a part of Google Tag Manager implementation to load asynchronously. If any of your tags takes time to load - it will not block other tracking tags and will not block your page render.

  • The credit for this asynchronous loading goes to the dataLayer object. The Data Layer object is like a queue which follows the first-in,first-out data structure.

  • Data Layer object collects API calls and tags are fired according to those API calls.

  • When you want to add something to this queue, you use the dataLayer.push method

  • As discussed earlier, the dataLayer.push method can be used to

    • pass your own defined data to Google Tag Manager via variables

    • can be used to record events.

  • So even if you don’t define the dataLayer object before your Tag Manager snippet, once the Tag Manager loads - it will create this dataLayer object if it was not defined.

Important notes about Data Layer

  • To make sure your Data Layer works fine, define your Data Layer variable  in the head section of your webpage, above your Google Tag Manager container snippet.

  • A Data Layer variable is only available until a user stays on that particular page. It’s value does not persist across all pages (at least not automatically). If you have a situation where you want to keep the data layer variable and it’s values to persist throughout the session of the user, you will have to write a custom code to achieve that.

  • Do not forget we are dealing with a Javascript object here - and remember how a Javascript object works. If you push a variable name that is already present in the Data Layer, the old value will be overwritten with the new value.

  • As you may have now realized - Data Layer approach to collecting data from your website is - nice. This approach to data collection is not only just a nice means to collect data, but also serves as an area for you to code - which is magically  isolated from your website code. This means that you can write and edit your Data Layer code that is independent from your website code and your data collection will not be broken by changes to your website due to less dependency on your website code.

  • Make sure to enclose your variable names in quote

 

dataLayer.push({new-variable: 'value'});

// Won't work

 

dataLayer.push({'new-variable': 'value'});

// Better

  • dataLayer object name is case-sensitive

datalayer.push({'pageTitle': 'Home'});

// Won't work

 

dataLayer.push({'pageTitle': 'Home'});

// Better

  • Variable names should remain consistent across pages

    • This won’t work

 

// Homepage:

dataLayer.push({'visitorType': 'low-value'});

 

// Checkout Page:

dataLayer.push({'visitor_type': 'high-value'});

    • Keep the variable names consistent.

    // Homepage:

dataLayer.push({'visitorType': 'low-value'});

 

// Checkout Page:

dataLayer.push({'visitorType': 'high-value'});

 

  • If you want to fire a tag when the page is loaded, like watching for productCategory to be 'Headphones', then productCategory must be defined before the tag manager loads - in the data layer above the container snippet (e.g. 'productCategory': 'Headphones'). This is because when you later push any variable to the dataLayer after the container snippet, the dataLayer won’t be able to fire the tags as information about the matching condition won’t be available in the dataLayer object.

  • Once you have migrated an already existing hard-coded tag from your website (or loaded by another tool/tag system) to Google Tag Manager, make sure to remove that tag from your website code (or any other tool/tag system) to avoid inflation of data and other data-integrity issues. You can read more on migrating your tags on Google Tag Manager document provided by google.

  • Multiple Domains - Although you can use one GTM container for multiple websites, it is recommended to have separate containers for each domain. However, if you have multiple TLDs or subdomains as a part of the same one website, it might be more insightful data for you when you just have one GTM container. As per google docs on Tag Manager,

   

    “When choosing to use a single container across multiple domains, it's important to carefully configure your tags and triggers within Google Tag Manager. Using the default “All Pages” trigger in Google Tag Manager (i.e. $url matches RegEx .*) will fire tags on all pages of all domains on which your container snippet is deployed. Since some tags have configurations or purposes specific to the domain on which they're deployed, you may need to create custom triggers (or even remove the “All Pages” trigger) to fire tags on all pages of one or each domain individually.”

Passing static values from Website into GA Custom Dimensions

  • Let’s say we have to pass two static values to Google Analytics every time a user clicks on “Add to Cart” button on the website.

  • The values we will collect will be productCategory and productName

  • In order to show these values in the reports of Google Analytics to see what products are being added to the cart, we will have to create two custom dimensions within Google Analytics.

  • So here are 4 milestones that we need to achieve in order to make this implementation possible

 

  1. Create two Data Layer variables in GTM - productCategory and productName

  2. Ask the developer to collect the two values of productCategory and productName when a user clicks “Add to Cart” - and push it to the Data Layer object

  3. Create two custom dimensions in GA - productCategory and productName

  4. Create a GA Tag which fires when user clicks on “Add to Cart”

 

Task 1 - Creating the Data Layer variable in Tag Manager

 

In order to receive data from the dataLayer that you pass - you have to create a Data Layer variable in Tag Manager.

  1. Go to Variables>User-Defined Variables>New

  2. Set the name of the variable that you can remember - productCategory

  3. Choose the variable type Data Layer variable

  4. Set the name of the Data Layer Variable name - productCategory

  5. Check Set default value and type not set. This will be the default value of this variable just in case the dataLayer fails to get the value.

  6. Save

 

  • Same way, you can create productName - the other variable of our example.

  • Now you have created productCategory and productName variables in your Google Tag Manager account. You can now collect the values for these variables from your website by pushing them to your dataLayer. As you have defined these variables in your GTM, you can use the collected values of these variables as

    • A condition to fire a tag

    • Transfer the values of these variables to a third party application like Google Analytics.

Task 2 - Push the values to the Data Layer object

We will collect the data of product category and product name when a user adds any product to cart. Since this is a user-behavior related data collection, we don’t have to hard-code this value when we are defining the data layer above the Tag Manager snippet. So we will define an empty Data Layer object first.

Next, when someone clicks on Add to Cart, the developer can collect and push the data (productCategory and productName) into the Data Layer object.

 

We have created the two variables in GTM and pushed the value of these two variables in our Data Layer object. However, we still need to send this data to Google Analytics. To see these two values in our reports, we have to create two custom dimensions.

Task 3 - Creating custom dimensions in Google Analytics

  • If you are using productCategory and productName values to be passed to Google analytics, you will have to create custom dimension in analytics to receive this data and to visualize this data in your GA reports.

 

  1. Go to your Google Analytics account’s Admin>Property>Custom Definitions>Custom Dimensions>New Custom Dimension>

  2. Name - “Product Category”

  3. Create

Once you have created a custom dimension in Google Analytics, it will give you a code snippet.

var dimensionValue = 'SOME_DIMENSION_VALUE';

ga('set', 'dimension1', dimensionValue);

 

Each snippet will have a dimension number (also called an index, example, - dimension1) that you should enter in Tag Manager in order to properly map the GA pageview tag to the proper custom dimensions.



 

Task 4 - Send data to GA

  • Create a GA Tag and a Trigger to Fire the Tag.

  • Now you have created your Data Layer method, and set up your custom dimensions in Google Analytics.

  • You have to now update your GA Tag in Tag Manager so you can map your Data Layer method to your GA dimensions that you created.

  1. Click Tags and open your GA Page View tag

  2. Options > Copy to create a copy of your GA tag. Name the new tag appropriately.

  3. Edit the configuration and change the Track type from Page View to Event

  4. Fill in the Category and Action fields with appropriate names

  5. Use selector in Label field and select your variable productCategory

  6. Check Enable overriding settings in this tag

  7. More Settings>Custom Dimensions>+Add Custom Dimension

    1. Index will be 1 as Google Analytics gave that index when we created our custom dimension there.

    2. Dimension Value - Use the selector to choose your created Data Layer variable productCategory

    3. Repeat for productName

  8. Triggering - We only want this tag to fire when a user lands on  the “Headphones” category page. So we have to put a URL in the condition.

    1. Create a new Trigger

    2. Name the trigger “Add to Cart” - this trigger is aimed to fire every time someone clicks the Add to Cart button and adds an item to Cart.

    3. Trigger Type - Click

    4. This trigger fires on Some link clicks

    5. Fire this trigger when an Event occurs and all of these conditions are true - Click Text equals "Add to Cart"

You have now set up

  1. The two Data Layer variables in GTM - productCategory and productName

  2. The two custom dimensions in Google Analytics - productCategory and productName

  3. the DataLayer object on your website code with values of productCategory and productName

  4. The trigger

Now you can go to Preview Mode and test your implementation of Custom dimensions before publishing it live.

 

Passing Dynamic values into GA Custom Metrics

 

  • Previously, we defined Data Layer variables to capture Users and Sessions metrics, and created some custom dimensions to collect the data that we need.

  • These were static values pushed to the Data Layer. Now we will pass dynamic values from the website to collect more valuable information and push it to the Data Layer. This time we will make use of Custom Metrics in Google Analytics

 

Goal - To collect dynamic values to calculate the Revenue of an e-commerce site

  • the total revenue generated

  • the average revenue generated

In order to know the revenue details of the website, we can

  • record the value of each item purchased

  • push this value to the Data Layer from the dataLayer object

  • create a Custom Metric in Google Analytics to collect total trip amount


 

Task 1 - Create a Data Layer Variable

  1. Go to Variables>User-Defined Variables>New

  2. Set the name of the variable that you can remember - tripValue

  3. Choose the variable type Data Layer variable

  4. Set the name of the Data Layer Variable name - tripValue

  5. Save

 

Next, we will add the Data Layer code on the “Thank You” page which passes the total trip value to the Data Layer.

 

Task 2 - Push the values to the Data Layer object

  • Now you can write a Javascript code that extracts the purchased Trip price from the URL, using a variable called tripPrice

 

var tripPrice = document.URL.match(/price=([^&]+)/);

 

dataLayer =[{'tripValue': tripValue}];

 

  • Notice that we did not use the Javascript .push method here, because we already have the value collected from the URL at the page load. So we define the Data Layer object and add the values right away.

 

  • Now once a user purchases something, its total value gets pushed to the Data Layer. You can test this by using the Preview mode of GTM.

 

Next, you will have to create a custom dimension in Google Analytics so that you can collect the trip amount.

 

Task 3 - Create a Custom Metric in Google Analytics

 

Custom metrics are set just like Custom Dimensions.

 

  1. Go to your Google Analytics account’s Admin>Property>Custom Definitions>Custom Dimensions>New Custom Metric>

  2. Name - “Trip Value”

  3. Formatting Type - Currency

  4. Check Active to make sure this metric is live.

  5. Create

 

Just like custom dimensions, custom metrics will present you with an index number that you can use to map to GTM.

 

You collected the trip value purchased and pushed it to the Data Layer, you created Data Layer object in GTM so it can receive your data that you pushed to the Data Layer. Still, the data is not being sent to Google Analytics. We have created a custom metric in Google Analytics that will populate in GA reports once we start passing the tripValue to GA.

 

Task 4 - Send data to GA

  1. Click Tags and open your GA Page View tag

  2. Check Enable overriding settings in this tag

  3. More Settings>Custom Metric>+Add Custom Metric

    1. Index will be 1 as Google Analytics gave that index when we created our custom metric there.

    2. Dimension Value - Use the selector to choose your created Data Layer variable tripValue

  4. Triggering - All Pages

  5. Save

 

Now we have set our custom metric tripValue and mapped it back to Tag Manager. Now we can build a custom report in Google Analytics to view this trip value data.

 

Task 5 - Create a custom report in Google Analytics to see the data

  1. Go to GA>Customization>Custom Reports> + New Custom Report

  2. Name - Total Trip Revenue report

  3. Add the custom metric along with Users and Sessions

    1. Metric Groups > Custom Metrics > Trip Value

    2. + Add metric > Users > Sessions

    3. + Add metric > Users > Users

  4. Add a dimension to measure the trip revenue

    1. + add dimension > User Type (to see which type of users purchased)

  5. Save

 

Tracking events using URL variables

Event triggers in GTM can be used to track the behavior of the user when they do certain actions on your website - like click a button or watch a video.

 

If the total number of visitors are 100, and 10 of them purchased - our ecommerce website’s conversion rate is 10%

 

Goal - To know the Booking Conversion Rate of the website - which is the total number of purchases on the website divided by the total number of website visitors.

 

To get the booking rate, we can set up an event trigger in GTM which fires every time a visitor clicks “Book Now” and record the total number of purchases on GA.

 

Task 1 - Create a user-defined URL variable

  1. Go to Variables>User-Defined Variables>New

  2. Set the name of the variable that you can remember - URL Destination

  3. Since we want to track URL where “Book Now” button is clicked, choose the variable type URL

  4. Since we only want to track a part of the URL that contains the country name, choose Component Type > Fragment (this will grab everything after # symbol in the URL)

  5. Save

We just created an event variable to capture the country from the Booked URL. Now we need to create a trigger that will fire when the “Book Now” button is clicked.

Task 2 - Create a click event Trigger

  • We need a way to tell GTM how to track the clicks on the “Book Now” button.

  • There is a built-in variable in Tag Manager that can be used with the classes of DOM elements. So we can listen to the click event by tracking the class attribute of the clicked “Book Now” button.

 

  1. Go to Variables>Built-In Variables>Click Classes

  2. Set up an event trigger, go to Triggers>New> Name - Book Now Clicks

  3. Since we want to track clicks, select event type - Click

  4. Since “Book Now” is an HTML link styled as a button (it is still a link) - Trigger Type - Link Click

  5. Check Wait for Tags,  Wait time 2000 ms to give the tag time to fire after the user clicks on “Book Now”. Continue.

  6. Enable when book-now class is present.

    1. Condition - Page URL contains booked.html

    2. Fire on - Some Clicks (Click Classes contains book-now

  7. Save Trigger

 

Task 3 - Pass data to GA

  • Now we have set-up our built-in variable in GTM and created a trigger, we need a GA Event tag that will fire whenever the Book Now button is clicked.

  • You can make a copy of the existing GA tag in GTM and modify this page view tag to an event tag as required. This will make sure it has all the settings we have included so far - like cross-domain tracking

 

  1. Click Tags and open your GA Page View tag

  2. Options > Copy to create a copy of your GA tag. Name the new tag appropriately.

  3. Edit the configuration and change the Track type from Page View to Event

  4. Fill in the Category and Action fields with appropriate names

    1. Category - Bookings

    2. Value - Book Now

    3. Label - Click the selector and select the user-defined variable we created earlier called URL Destination

  5. Continue

  6. Since we only want this new tag to fire when the Book Now button is clicked, remove “All Pages” from the trigger section and Select the Book Now Clicks trigger you created earlier in Task 1.

  7. Save

 

Now you have created a user-defined URL variable and a GA Analytics tag that triggers every time a user clicks on Book Now button. It passes the value that is collected from the URL to Google Analytics as an event.

 

You will now see all the Bookings that were made in Google Analytics as events. You can divide the total with the total number of visitors to get the Booking Conversion Rate for your ecommerce website.

Google Ads tag in Google Tag Manager

  • If you use Google Ads to advertise your website, you can implement Google Ads conversion tracking code with your GTM implementation to gain insights into the behavior and purchases of users coming through your advertising efforts for your website.

 

  • Since every user that comes through an ad costs you, it is obvious that you would want to attribute the conversions that happened through advertisements to be attributed to the Google Ads (or any tag of third party application where you are placing ads, like Facebook, Instagram etc.).

 

  • You can use this data to understand how your ad campaigns are doing, and optimize your ads and your budget accordingly.

 

  • You may also want to use Google Ads conversion tracking to your website to use remarketing feature of Google Ads to gain more effective campaigns and more conversions.

 

Steps to Install Google Ads using Google Tag Manager

  1. Get the Conversion ID and Conversion Label from your Ads Account

    1. Click Tools>Measurement>Conversions

    2. Select the Conversion you want to use to track.

    3. Expand Tag Setup to view the details of the tag

    4. Select Use Google Tag Manager card.

    5. Copy the Conversion ID and Conversion Label. You will need it in the following steps.

  2. Go to your GTM and select Tags > New > give it a Name

  3. Tag type - Google Adwords Conversion Tracking

  4. Paste Conversion ID and Conversion Label that your copied from your Google Ads account

  5. Conversion Value - This is the value of your conversion. So you can create and use a custom variable that captures the amount from your website and pushes it to the Data Layer. (Explained in “Passing Dynamic values into GA Custom Metrics” section)

  6. Currency Code - Add any standard abbreviation of currency codes.

  7. Continue.

  8. Trigger - This tag should trigger on all pages so we will know if adwords brought the users to any page of the website.

  9. Create Tag

 

You should use the GTM Preview mode and click few ads to make sure your conversions are being tracked.

Facebook Pixel tag in Google Tag Manager

  • By installing Facebook Pixel tag to your website, you can attribute facebook related conversions to Facebook.

  • You also get the benefit of using Facebook Analytics - to get more statistics about your Facebook ad campaigns and how you can refine and optimize for more conversions.

  • You can only have one Facebook pixel per account.

 

Steps to install Facebook Pixel tag in Google Tag Manager

  1. Get the Facebook Tracking code

    1. Go to Facebook Events manager menu > Pixels > All Tools - Event Manager > Pixels

    2. Add Data Source - Facebook Pixel

    3. Setup > Manually install the Code yourself

    4. Copy the Pixel code

  2. Go to GTM > Tags > New > Custom HTML - Paste the code here.

  3. Advanced Settings > Tag firing priority > Type 100 or any higher number that is higher than other tag priorities that you may have set.

  4. Trigger > All Pages

  5. Go to Preview mode and test your implementation.

  6. All good? Publish your changes to Live.

Now for every user that comes to your website through Facebook ads, your website will send the pixel (data) back to Facebook so you can see the data in your Facebook Pixel analytics reports.

Build Custom Conversions in Facebook Pixel

Just seeing the users coming to your website from Facebook ad campaigns is not enough. You should know what is the behavior of your Facebook ad users and track conversions that came through facebook. To track that, you need to create custom conversions in your Facebook Pixel.

 

For example, if a conversion for you is when a user lands on a page which is confirmation.html, you can let Facebook know that this is counted as a conversion for you and your website goal was reached by a user that came through a Facebook ad campaign.

 

  1. From your Pixel Dashboard of Facebook Events Manager, go to Custom Conversions

  2. Website - All URL Traffic

  3. Rule >  URL contains /confirmation.html

  4. Name this conversion as Purchase

  5. Category - Purchase

  6. Value - put a value if you have one

  7. Create

Build Custom Audiences in Facebook Pixel

Just like in Google Analytics, you can create audiences in Facebook Pixel for remarketing.

 

Let’s create one where we want to create an audience of everyone who visited the site through Facebook Ads in the past 30 days.

  1. Events Manager Menu > Assets - Audiences

  2. Create Audience - Website Traffic (As you already have the Facebook Pixel installed on your website thats sending website traffic)

  3. Include people who meet ANY of the following criteria

    1. All website visitors in the past 30 days

    2. Give an Audience name

  4. Create

Sending custom event data to Facebook Pixel

Facebook Pixel has something called Auto-Event tracking which means that it sends some microdata on its own and tries to understand the goals of your website and present it in its analytics. For example, with every click on a button, Facebook send the click data like click URL, click Text etc.

 

However, more often than not, these statistics may not really be beneficial for your tracking and you would want to send Facebook some custom data that you actually care about.

 

Here is an example of creating a Click trigger on Google Tag Manager to fire our Facebook pixel. This trigger will fire Facebook pixel when defined conditions are met. In this example, we fire Facebook Pixel when user clicks on Add to Cart button.

  1. Go to GTM Triggers > New > Name - Click - Add to Cart

  2. Click - All Elements

  3. Some Clicks > Click Classes contains your-add-to-cart-class-name

  4. Now you have Trigger ready. Now create a new Facebook Pixel tag and add this trigger to it. Tags > New > Custom HTML

    1. You have to paste Facebook predefined code for Add to Cart here. Go to your Pixel Setup > Manually install the code yourself > Continue > Events - click the slider for Add to Cart > Copy the code

    2. Paste in to GTM Custom HTML tag configuration

  5. Select Trigger you just created

  6. Save

  7. Preview to test

  8. Publish. Yay!

What can you do with this information on Facebook Pixel? You could use this to create a custom audience for every user who fired this event (clicked on Add to Cart).

 

Sending custom variables data to Facebook Pixel

You know how to send custom event data like clicks, and page views to Facebook Pixel. But how do you send information like the amount of goods purchased by a user on your website back to Facebook Pixel? You can do that by sending this data using custom variables.

 

Let’s take an example of a checkout page. Now you could use Custom Conversions in Facebook Pixel and say if the user landed on a page url that contains /checkoutcomplete, you count that as a conversion. However, you know how many conversions happened, but you don’t know the price of that conversion and you also don’t know what they bought.

 

Let’s see how we can get that information out of our website and pass it to Facebook Pixel with our Google Tag Manager. What we need to do is send this conversion value to Google Tag Manager first, so we can pass it to Facebook Pixel. To achieve this, we will create a custom dataLayer object as we discussed earlier.

  1. Set up the dataLayer in your code and pass the data you need to pass to the dataLayer object.

  2. Set up the variable(s) of type Data Layer in your GTM and provide the same Data Layer variable name that is in your dataLayer object.

  3. Now you need to create a trigger and a Facebook tag to fire. Tags > New > Custom HTML

    1. Go to Facebook Pixel > Setup >  Manually install the Code yourself > Events > Purchases

    2. Copy the code and Paste it to your Custom HTML tag configuration. You should make sure to update this code by adding your custom variable name here: For example:

fbq('track','Purchase',{

        value: {{your-value-variable-name}}

}

  1. Trigger - We want to trigger this tag only when the event takes place. And the event is when a user lands on the page with a URL that contains /checkoutcomplete

  2. Preview to Test

  3. Publish!

 

Setting up Dynamic Remarketing

  • A user comes to your site and leaves. Later she browses the internet and sees your ad again. This is you - trying to convince her to come back to your website and make that purchase. This is Remarketing - re-engaging the user to make a purchase.

 

  • You can even add special offers to entice the user to re-engage with your site again by clicking your ad.

 

  • Web remarketing could offer special offers to new or already visited users to convince them to come to your website back or download your app.

 

  • Once you set up remarketing, you can create specific audiences that enables you to target different sets of users that are grouped based on common attributes.

 

  • For example, you can specify that an offer should only be shown to users who visited your website more than a month ago. This way, only the users who have not visited your website or app for a while will only see the special offer.

 

  • Audience Lists are a collection of cookies that are collected from users browsers when your users visit for the first time, if you have Google Analytics Remarketing feature enabled. You can use these lists to target specific users.

  • You can create Audience Lists based on following predefined audiences

    • All users to your website

    • Users who visited a specific page

    • Users who completed a specific goal

    • New users that Google recommends to be potential users who will convert using their machine learning algorithm

 

  • You can integrate Google Analytics with Google Ads to target users based on a specific sequence or combination of actions. For example, you can build an audience list of users who came by clicking an ad to a specific landing page of your site, spent 30 minutes on the page but did not make a purchase.

Developing a tag implementation strategy

 

Identify the data stakeholders and Define data layers

Typically are three types of users for the data you collect from your TMS implementations

  1. Business people and marketers

  2. Analysts - from BI or Data Science teams

  3. Technical - folks from site operations and development

 

  • Who needs the data and what data do they need?

  • The data you collect from your website and any digital interaction with your customer is helpful for different departments of your organization.

  • For example: Data about how many purchases happened through the website will be required by the Sales and Marketing team.

  • The tag implementation strategy revolves around creating data layers so you define the flow of every piece of data - what data is being received and where it needs to go.

A Data Layer may have following attributes

  • A name

  • A description

  • An owner

  • A source

  • A purpose

Example of a data layer could be data about video interaction of the user on a website. It is important to define all the data that you are collecting and its purpose for all the stakeholders to understand and to avoid confusion between different data layers. Different people in your organization may understand a particular data in their own way. Defining data layers works as a kind of couple’s therapy to make people in your organization understand each others better.

Data Governance and Vendor Management policy

  • How people in your organization request data from you?

  • What data are they allowed to request for?

  • Who is allowed to add a new Vendor? To make sure people who have access to your TMS do not add any unapproved vendor Javascript code.

Scaling TMS in multiple deployments and domains

  • Consider if new sites are going to be added in the future. Do you have multiple domains, stores, brands or micro-sites?You may have new potential teams and assets introduced later into tag management.

  • Library approach to Tag Management - Having a pre-defined set of data layers, rules and tag vendors. To make sure you have a certain standard template that not only meets the needs regionally but also globally.

Documentation

  • Documenting all the data layers, the stakeholders and the data governance.

  • Requests for a feature and requirements document.

  • New people getting involved with the TMS data supply chain come with their own understanding and varying level of knowledge of the process. Your internal documented processes of how you approach tag management becomes key for onboarding new people to the team.

  •  

Defined Process for Request for New Features

  • When a new feature or tag request is created, it should have a defined process to go through.

  • Building templates and  forms for request submissions.

  • This helps in faster collaboration and scalability

Stability and Maintenance

  • Tracking and maintaining these Tags that you have built in your TMS, the end goal of making sure you are collecting quality data for your organization.

  • Security - Your TMS is an exclusive party - and not everyone is invited. Make sure you have up-to-date guest lists and guard the doors to make sure only the authorized guests are allowed in.

  • Have a clear owner.

  • Accurate and updated documentation.

  • Spot Data Leakage - A tag installed long back but the vendor is not being used anymore and no one removed the tag. Maybe someone demoed a tag and forgot to remove it later.

Additional References that are nice to Bookmark

  1. All Built-in Variables

  2. All User-Defined Variable types

  3. Enabling Remarketing and Advertising Reporting Features in Analytics

  4. Triggers

 

Comment Form is loading comments...



Table of contents