Week 6— My Journey into Data Analytics — DA Minidegree Review — CXL Institute
Welcome to Week 6 of our Journey Into Data Analytics, this week I started Google Tag Manager for beginners, I am halfway through it. I have always wondered how Tag Manager worked and it appeared very complex to me always. This module is a lifesaver, Mercer explains Tag Manager with ease and I am impressed with the Simple yet detailed Lessons that cover all the basics. Mercer emphasizes practice along with lessons and also provides protip and mistakes that can occur. Let's Dig into the Lessons, Shall we?
Your Introduction to Google Tag Manager Basics
Most of the third-party ad and measurement platforms require code or script to be installed on the website, all of this most of the time require a developer’s help. These tasks become confusing over time as we increase the number of traffic channels. To reduce this complexity, we can use Google Tag Manager.
Google Tag Manager is a tag management system (TMS) that allows you to quickly and easily update measurement codes or scripts known as tags on your website or mobile app.
Google Tag Manager uses these concepts to handle how tags are configured and fired:
- Tag: A tag is a code that sends data to a system such as Google Analytics.
- Trigger: A trigger listens for certain events, such as clicks, form submissions, or page loads. When an event is detected that matches the trigger definition, any tags that reference that trigger will fire.
- Variable: A variable is a named placeholder for a value that will change, such as a product name, a price value, or a date.
- Data layer: The tag manager implements a data layer to temporarily hold values in the client so that they can be used by tags, triggers, and variables.
Getting to Know GTM: Tags
Tags are snippets of code or tracking pixels from third-party tools. These tags tell Google Tag Manager what to do.
There are 2 Kinds of Tags — Built-in and Custom HTML
Examples of common tags within Google Tag Manager are:
- Google Analytics Universal tracking code
- Adwords Remarketing code
- Adwords Conversion Tracking code
- Heatmap tracking code (Hotjar, CrazyEgg, etc…)
- Facebook pixels
Getting to Know GTM: Triggers
Once the Tag has been set up, Triggers help to fire the Tag, They tell the Tag Manager when to take the action.
Eg: Facebook (Tag) -> Page View (trigger)
Google Analytics (Tag) -> Conversion (Trigger)
There are mainly 4 Types of Triggers
- User Engagement
- Other Triggers
Note: You can filter the trigger using a variable, operator, and value
Getting to Know GTM: Variables
Variables are additional information that GTM may need for the tag and trigger to work.
Eg: Pageview -> /welcome (variable)
Page Video -> All about widgets (variable)
Conversion -> 30 (Variable)
Note: There can be more than 1 variable, variable changes according to clicks on-page.
Eg: Pageview (Event) -> /welcom and -> yourwebsite.com
The variable value changes if we are on the homepage, Variable value -> homepage, when we move to product page -> change to the product page URL -> /product
There are 2 types — Built-in and User-defined. variables are used in both triggers and tags.
In Trigger -> as filter eg: Fire a trigger when the URL variable contains “example.com/index.html)
In Tag, -> use to capture dynamic values. eg: Pass a transaction value and Product ID to a conversion tracking tag.
Getting to Know GTM: Data Layer
The data layer stores the data temporarily that the Tag manager might Need. It is a combination of Key and Values. When GTM loads, the Data layer is created. In Single Page Application, GTM loads once and only 1 data layer is created
Note: Each Key can have multiple values. Treat it like a category with different values.
Note: Data layer variable enables Tag Manager to read values from the Data layer implementation and pass those values to tag, triggers, and other variables.
Eg: If we receive 90% scroll dept from the Data Layer, we can fire a trigger and tag for engagement.
categories of information the data layer can handle
- Product data: Product name, price, category
- Marketing campaign information: Traffic source, medium
- Transaction data: Cart value, checkout date
- Customer information: New or returning customer
Getting to Know GTM: Preview Mode
Preview Mode is an incredibly useful feature allowing you to determine if tags are firing properly. To access Preview Mode, look for the Preview button in the upper-right section of the top bar in GTM.
Note: Whenever the changes are made, refresh the preview mode as well as the website to see the reflected changes.
Note: There is an updated Preview mode, you can learn more about it here
Getting to Know GTM: Workflow
To make sure that we are using Tag Manager correctly, we should follow a workflow. This helps in reducing the errors and efficiently using all features.
Step 1 — Create a Workspace. If multiple people are working on TM, it is advisable to create a workspace and implement changes as this will help to avoid stepping on toes with others.
Step 2 — Makes the Changes and Check-in Preview mode. This helps to test if the tags are getting fired with correct information
Step 3 — Publish and create a version. Make sure to name the version correctly, the version name should directly indicate what has happened in the version. Eg: Added Facebook Pixel or Initial Setup — Added variables
Step 4 — You can add an additional description about changes in the Version
Step 5 — Publish to the environment. GTM environments allow us to first publish a container/workspace to a development or staging server instead of immediately publishing to a live server.
Note: Make sure to merge the versions once they are published.
Getting Started: Creating Your First Tag
Let’s start by creating a Google Analytics -> Pageview Tag. But before that, we should make sure that pageviews in not collected both on Tag Manager and Google Analytics, this will lead to duplication.
Steps to Create a GA Page View Tag
- Select from the Built-in Tag -> GA -> Universal Analytics
- Select the tag type as Page view
- Create a new Variable, and fill the Tracking ID (This is your UA ID), and let the cookie domain remain auto (default)
- Name the Variable as — GAS — Website Name
- Select the Trigger -> All Pages (built-in)
- Name the Tag -> GA — Pageviews
- Test if the tag is firing with preview mode
- Verify-in GA, Go to Realtime-> content-> this should show the landing page we are currently on
- Finally, Publish the Workspace changes (we are currently in Default Workspace)
- Voila! your first Google Tag is created
Similarly, Let’s try to create a tag to install Facebook pixel with GTM
- Create a new Tag, as we do not have a built-in Tag, we shall use Custom HTML.
- Copy the Pixel Code from Facebook and Paste it here
- Set the Trigger to All Pages (built-in)
- Name the Tag as FB — Page view
- Switch on Preview mode and test if the tag is fired
- To verify, use the Pixel Helper and check if the Pageview is fired
Let’s do one more, Install the Google remarketing Tag
- Use the Built-In Tag and input the conversion ID and Name
- Set the Trigger to All Pages (built-in)
- Test and Verify the changes using Preview Mode
Note: If you are using Google ads, use conversion Linker, no configuration is required and the trigger should be All Pages
How about 3rd Party Scripts like Hotjar and Paypal
Hotjar — use the Built-in Tag for Hotjar set and set the Trigger to All Pages
Paypal — Paypal does not have a built-in tag, so we shall use Custom HTML (Take the Script from PayPal account) and Set the trigger to all Pages
Do you see how easy it is to set up 3rd party scripts using Tag Manager. Next week we shall cover Tracking Engagements, Ecommerce, Cross Domain, and Deep dive into Data Layer.
Concluding this week with a partying thought as always
Half the money I spend on advertising is wasted; the trouble is I don’t know which half — John Wanamaker