Week 7— My Journey into Data Analytics — DA Minidegree Review — CXL Institute
This week I finished the GTM: Beginners Module (Phew, Finally!), I wouldn't deny that as the lessons proceeded things got a little complicated but Mercer sheds immense clarity and his step-by-step approach towards each topic puts one at ease and keeps them engaged. I have started practising and implementing some of these tags for my clients and I am sure these are going to help me to make wiser decisions.
Let’s discuss the Lessons I covered this week.
Tracking Engagement: Clicks & Time
When a person is on a website, the most important action he takes is the clicks. GTM enables us to track and understand user click behavior.
With Google Tag Manager the most popular tracking use cases are:
- Button click tracking (e.g. “Add to Cart” button clicks)
- Outbound link clicks (track when a visitor clicks a link leading to an external resource (3rd party website))
- File link clicks (e.g. when someone clicks on a link that downloads/open a PDF file)
- Menu link clicks (e.g. The Dropdown menu links from the Header or sidebar)
Before Setting up the Tag and Triggers, we shall collect the information with help of our Click Variables, which are built-in. They are click element, click class, click ID, click target, click URL, click text. Once we have set it up, we shall move towards exploring the Triggers.
There are two types of click triggers in Google Tag Manager: All elements and Just links. All elements trigger track clicks of any element (link, image, button, etc.), while Just links trigger tracks link clicks only.
Variables act as conditions or filters for our triggers. Let’s suppose I want the trigger to only fire when the user clicks on Add to Cart Button. Here I would first set up my variables, then understand which variable can be used as a condition, Eg: Click Text = Add to Cart, once identified, I shall create the Trigger.
Once the Trigger has been decided, we shall pass this information to Google analytics by Tag
Protip — Use a CSS ID to figure out the Images and Click text to find the Hyperlink text.
—Let’s create a Tag for Facebook Share button on your Website
Step 1 — Create a GA Tag with the following settings
- Track Type — Event
- Category — Engagement
- Action — Social
- Label — Share
- GA Setting — Use your GA Variable
step 2 — Create a Trigger
- All Elements -> Some Clicks
- Condition — Click Text contains “Share”
- Condition — Click class contains “simplesocialtxt”
(These variable values are taken from the website, Preview your website to find the exact values)
Step 3 — Save the Trigger as “Click — FB Share” and Tag as “GA — Event — Share”
Step 4 — Test But verify using Preview and GA Realtime Events
Google Tag Manager’s timer trigger helps to measure the amount of time a user spends on a page to complete a task (e.g. read an article, fill out a form, or complete a purchase.)
Let’s quickly create a 15-sec interval timer with a limit of 3
Step 1 — Create the trigger as Timer and
Condition — Page URL — Matches RegEx -> .*
(.* indicates that we are using the timer for all pages)
Trigger Name — Timer — 15 x 3
Step 2 — Create a Universal Analytics Tag for Hyper Engagement. In the Label section of the Tag, we will specify “click URL — {{click URL}}” as we would want to know which page is the user on when the timer was fired
Step 3 — Publish the Tag, Test and Verify using Preview and GA
Note: In Google Analytics, bounce rate is calculated by the number of single-page sessions divided by all sessions for each website page, meaning that Google Analytics is looking for any interactions on a page. If you set Non-Interaction Hit=false, the event will affect your bounce rate. Set Non-Interaction Hit=True if you don’t want the event to affect bounce rate.
Tracking Engagement: Scroll
Scroll Depth tracking allows us to easily get insight into the scrolling behavior of users on the website, how users are engaging with the content. It also helps us to understand the Bounce rate and Conversion rate from an engagement perspective.
Some of the use cases are To measure the lead Optin i.e how many people are scrolling till the end of the page to signup.
Let’s Create a Trigger for Scroll. This is a one-time setup. You will find the scroll Triggers in user engagement. We shall use the scroll depth.
- Choose Vertical with Percentages 10,25,50,75,90
- Choose Trigger type as All Pages
Once the trigger is firing properly, we shall pass this information to GA by using UA Tag
Protip — Interaction Hits are visible in Action Users and Non-Interactive Hits are visible in Events (Last 30 Days) in Real-time reports.
Note — Ensure that the Non-Interaction Hit tag setting is changed to ‘True’ and is configured with the appropriate GA Property ID.
Tracking Engagement: YouTube Videos
The actions such as Start, Pause, time watched can be tracked using the youtube video. This is one of the easy tag set up, but it an important to understand the engagement of the users on your videos.
Step 1 — Enable video-related variables on GTM
Step 2 — Set up the Trigger from User Engagement -> Youtube video
Step 3 — Make sure to check the Add Javascript API Support and use this trigger for all the videos on your website.
step 4 — Create a GA Tag, “Track Type” option, select “Event” and provide the necessary parameters. Category and Action are the required parameters. set the non-interaction hit as False
Data Layer 101: Storing Details
How to push data to dataLayer? Suppose we have a Multiple option question and the options are Bugs Bunny and Daffy Duck. I want to push the Data Layer event of Character Updated once an option is chosen by the User. Let’s create a Data Layer push whenever the User clicks on Bugs Bunny Option
Step 1 — Create a Custom HTML Tag
<script>
window.dataLayer.push({
‘character’: ‘Bugs Bunny’
});
Name this as DLP — Bugs Bunny
Step 2 — Create the Trigger for Just links with conditions “click text contains Bunny” and “click URL contains p=58”
Step 3 — Create a GA Tag and Pull the data from DataLayer
Note: we have got the variable values from the preview mode
Deep Dive: Cross-Domain Tracking
If the flow of your website user experience moves between more than one domain (e.g. example-products.com to example-checkout.com), 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 the number of users that appear in your reports.
Steps to setup cross-domain tracking
- In your GA Variable, select More Settings > Cross Domain Tracking and add all the domain names.
- Go to More Settings > Fields to Set and check the “allowLinker” as True
Deep Dive: Tag Sequencing
As the name suggests Tag sequencing enables sequential firing of tags that have dependencies with each other. Google Tag Manager loads asynchronously, there’s no real guarantee that a specific tag will load directly before or after another tag. Tag sequencing gives you the power to set a tag sequence to have up to 3 tags fire one after the other in exact order.
The sequence is created by editing the Advanced Settings of the main tag. You will see two settings here:
- Fire a tag before… (the setup)
- Fire a tag after… (the clean up)
Deep Dive: Formatting Variables
GTM can format and transform the returned value of a user-defined web variable. This is extremely helpful as we no longer need to create Custom JavaScript variables to change the output of other variables to lowercase, or to change undefined values
To Format, a Variable, click Format Value at the bottom of any user-defined web variable page and select one or more options:
- Change Case to… (lowercase or uppercase)
- Convert null to… (text or variable)
- Convert undefined to… (text or variable)
- Convert true to… (text or variable)
- Convert false to… (text or variable)
Note: Formatting of values is only available for User-Defined variables, not the built-in variables.
With this, we conclude the GTM: Beginner Module, Next week we shall learn more in our GTM: Intermediate Module and also shed light on GA4.