CXL Institute Course Review: Google Tag Manager (GTM) for Beginners (Part-2)

GTM for Beginners Course by CXL

In the previous post I have covered few lessons of Google Tag Manager for Beginners course from Digital Analytics mini degree from CXL. This week I will be covering the remaining lessons. If you are visiting my post for the first time, I recommend you to visit my previous post, Google Tag Manager Beginners Course (Part-1) for a clear understanding on this course. Feel free to come back on every Mondays and read about CXL Digital Analytics mini degree review.

Tracking Engagement: Clicks

Google Tag Manager uses trigger configurations to fire tags in response to events. This article explains how to use Tag Manager to set up Universal Analytics event tags that are triggered in response to clicks on links, clicks on other types of elements, at timed intervals, and when a forms are submitted.

Steps to create Click Event in GTM

  • Login to GTM and enable Tag Manager to capture clicked URL data
    • Click Variables.
    • In the Built-In Variables section, click Configure.
    • Enable the checkbox for Click URL.
GTM Variables Setup
GTM Variables Setup
  • Create Triggers that listen for any link clicks on our website.
    • Click Triggers and then New.
    • Click Trigger Configuration and then Click – Just Links.
    • Add below settings to the trigger configuration:
      • Wait for tags: Enable
      • Max wait time: 2000 (milliseconds)
      • Check Validation: Disable
      • Enable this trigger when all of these conditions are true: Page URL and then contains and then /
      • This trigger fires on: Some Link Clicks and then Click URL
      • Name the trigger “Click – Any Links” and save the trigger.
GTM Trigger setup
GTM Trigger setup
    • Create new Google Analytics Tags to measure clicks for each page:
      • Click Tags and then New.
      • Click Tag Configuration and then Google Analytics – Universal Analytics.
      • Set Track Type to Event

    • Enter Event Tracking Parameters:
      • Category: Behavior
      • Action: Click
      • Label: {{Click URL}}
      • Tag Name: “GA-Event – Any Link”
      • Non-Interaction Hit: False
      • Google Analytics Settings: Select an existing Google Analytics Settings variable, or create a new one.
    • Click Triggering and select the trigger that you created in step 3, titled “Trigger – Any Clicks”.
    • Give the tag a name and save the tag configuration.
    • Publish the container.

Tracking Engagement: Scroll

GTM Scroll event setup
GTM Scroll event setup

The scroll depth trigger is used to fire tags based on how far a user has scrolled down a web page. Here you can track the scroll in the vertical or Horizontal.

  • Vertical Scroll Depths fire based on how far down a user has scrolled the page.
  • Horizontal Scroll Depths fire based on how far to the right a user has scrolled the page.

To configure a scroll depth trigger:

  • Click Triggers and then New.
  • Click Trigger Configuration and choose the Scroll Depth trigger type.
  • Select scroll depth options.
  • Select when the trigger should be enabled.

Tracking Engagement: YouTube Videos

The YouTube Video trigger is used to fire tags based on interactions with embedded YouTube videos on web pages.

With each interaction, data about the video and playback status is pushed to the data layer. Before you work with this trigger configuration, enable built-in video variables for data that you would like to capture.

GTM Video event Tag
GTM Video event Tag

How to create YouTube Video trigger in GTM:

  • Click Triggers and then New.
  • Click Trigger Configuration and choose the YouTube Video trigger type.
  • Configure the trigger:
    • Start: Fires an event when the video begins to play.
    • Complete: Fires when the video finishes.
    • Pause, Seeking, and Buffering: If the video is paused, the scrub bar is moved, or if the video buffers, the trigger will fire.
    • Progress: Fires at specified video progress points, configured by percentage or time threshold values:
      • Percentages: This value indicates the percentage of the video that has been played. Enter percentages as a comma separated list of one or more integers. Example: 5, 20, 50, 80, which represents 5%, 20%, 50%, and 80% respectively.
      • Time Thresholds: This value represents the number of seconds that the video has played. Enter time thresholds as a comma-delimited list of one or more integers. Example: 5, 15, 60, 120, which represents 5 seconds, 15 seconds, 60 seconds, and 120 seconds respectively.
    • Enable this trigger on: Select the appropriate option:
      • Container Load (gtm.js) occurs as soon as possible when the page loads.
      • Window Load (gtm.load) (default) occurs after all initial content on the page has loaded.
      • DOM Ready (gtm.dom) occurs after DOM is ready to be parsed.

YouTube Video triggers will work both on and after page load, so long as at least one of these items is present when Tag Manager loads:

  • An embedded YouTube video.
  • The YouTube IFrame API <script>.

Data Layer 101: Storing Details

Create a data layer variable

  • Data layer variables enable Tag Manager to read values from your data layer implementation and pass those values to tags, triggers, and other variables.
  • A data layer object is made up of a list of key/value pairs. A key is a category of things – a book’s category, title, or author.
  •  Each key could have different values. A book’s title key could have a value of ‘Business Solution’, ‘Digital Marketing’, etc.

Add data layer code to your web page

To set up your data layer, work with a developer to add the following snippet of code to the <head> section of your web page above your container snippet:

What is Variables?

To a computer programmer, a variable is a symbol in code that can be used to represent a value that will change. A Tag Manager variable performs that same function. Tag Manager variables are used in both triggers and tags.

  • Variables in triggers are used to define filters that specify when a particular tag should fire. Example: Fire a page view trigger when the url variable is “”.
  • Variables in tags are used to capture dynamic values. Example: Capture and apply the transaction value and products purchased to a conversion tag.

Tag Manager provides a set of commonly-used built-in variables in each container. You can create additional user-defined variables to suit your specific requirements.

Set up the data layer variable

Once you have the key that you would like to work with, you can proceed to create a data layer variable:

  • Click Variables.
  • Under User-Defined Variables, click New.
  • Click Variable Configuration and select Data Layer Variable as the variable type.
  • In the Data Layer Variable Name field, enter the key exactly as it was written in the code (e.g. bookTitle, not book title.)
  • In most cases you should leave the Data Layer Version set to the default value of Version 2. Learn more.
  • Save the variable.
  • Repeat these steps for every data layer key that you would like to have available as a variable in Tag Manager.
  • Publish the container.

Data layer variables only work on a per-page basis. If you would like the data layer values to persist through multiple page views, you will need to add your own code to pass data layer values between pages.

Tracking E-Commerce: The Basics

Two main types of Universal Analytics ecommerce implementation methods:

  1. Standard ecommerce
  2. Enhanced ecommerce.

Standard ecommerce reports allow you to measure transactions and analyze purchase activity on your site or app. You can see product and transaction information, average order value, ecommerce conversion rate, time to purchase, and other data.

GTM Ecommerce setup
GTM Ecommerce setup

Set up a standard Universal Analytics ecommerce tag:

  • Login to your Google Analytics Account
  • Enable ecommerce for the view.
  • Create a Universal Analytics tag and set the Track Type to Transaction.
  • Configure your tag with the required fields.

Enhanced ecommerce adds additional functionality to standard ecommerce reports. Enhanced ecommerce shows when customers added items to their shopping carts, when they started the checkout process, and when they completed a purchase. You can also use enhanced ecommerce to identify segments of customers who fall out of the shopping funnel.

These instructions describe how to use Google Tag Manager to implement Universal Analytics ecommerce tags. This will be discussed further in the Intermediate GTM course.

Deep Dive: Cross-Domain Tracking

If the flow of your website user experience moves between more than one domain (e.g. to, you should set up your Universal Analytics tags to measure those visits as one. Without this functionality, Google Analytics will treat this user as two separate visitors, which will inflate then number of users that appear in your reports. This occurs even if both domains use the same Tag Manager container and Analytics account.

In the next post I will be covering the Intermediate Google Tag Manager course from Digital Analytics mini degree from CXL. Feel free to come back on every Mondays and read about CXL Digital Analytics mini degree review.

Thank you!



I am Isak, founder and author of blog. A best place to have article through guest posts. I love reading (learning), sharing my skills and knowledge with all over the world using modern digital platforms.