Setting up Google Analytics Tracking with Google Tag Manager

Setting up Google Analytics Tracking with Google Tag Manager

09.04.2020.

Our agency is often called to help increase sales for small young eCommerce businesses. Before we reach an agreement on how to help them, we check their Google Analytics stats. Most of the time we are surprised that this most used analytics tool is poorly set-up or is not set-up at all. Our first presumption is that these businesses are not making their decisions based on data. And usually, we are right. 

For some time now I have had the idea of writing a blog about basic google analytics settings every eCommerce business should have. Demographic metrics, info about the device, browser and other technology shoppers are using, bounce rate, average session duration, conversion rate, and revenue are key inputs when one is making important decisions. 

 I will write about setting-up Google Analytics and Google Tag Manager, which are two powerful free Google tools. If you are not familiar with Google Analytics I suggest that you read more about it on the web. In this blog I will presume that you have some basic understanding of it. But for those who need some memory refreshment, Google Analytics (GA) is a web-based platform that allows you to collect data about the visitors to your website and is split into four areas.

Audience (find out who visited your site), Acquisition (how people get to your site), Behavior (what they were doing on your site) and Conversions (did they do as you expected from them).

Google Tag Manager (GTM) is a tool 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. With GTM you can install all of the Google or third-party tags like Facebook, Twitter, Bing Ads, Hotjar, etc. In short, you can do that with minimum knowledge of coding and without involving developer track button clicks, scrolling, video views, etc.

How to set up Google Analytics

If you do not own a Google account, you need to create one. We suggest that you create a different account for your business. It is just a matter of hygiene. When an account is created, go to the Google Analytics site and login to Google Analytics dashboard. 

Create a property for your site. A property represents your website, and is the collection point in Analytics for the data from your site. If you own more sites, you will have more properties.

First, you will need to choose what you are measuring (Web, Apps or Apps and Web). And second, you should write your site’s descriptive name, exact URL, industry category and reporting time zone.

1. Set up a reporting view of your property. Name it and set reporting time zone.

Google Analytics New Reporting View

2. Create a backup view in your property under Admin settings. It is good to have one in case you set too many restrictions or filters on the primary reporting view. This way you will not lose any data.

Google Analytics Backup View

3. In Property Settings enable Allow manual tagging, Demographics and Interest Reports, use Enhanced link attribution and enable Users Metric in Reporting.

Google Analytics Property settings

Google Analytics User Metric in Reporting

4. In View Settings of your Reporting view choose E-commerce Settings and enable E-commerce and Enhanced E-commerce Reporting.

Google Analytics Enhanced E-commerce Settings

5. In order to have clean data, you also need to exclude your own site visits from Reporting View. You can do that if you have a static IP address at your office. You can set it at Filters on View Settings, click on Add Filter, Create new Filter and under Filter Name write My home IP. Than select Predefined Filter Type, Exclude traffic from the IP addresses. This is where you write down your IP address.

Google Analytics set up IP Filter

6. For connecting your site to Google Analytics, you will need to insert Global Site Tag or Tracking ID on your site. How to do that depends on site CMS you are using. Some CMSs like WordPress or Magento will need a separate plugin that will send eCommerce data to your Google Analytics. Shopify offers this option by default. I suggest you google how to do that. In search bar just type something like: “your CMS” google analytics enhanced eCommerce tracking and follow instructions. You can find tracking info under Property, Tracking Code.

Google Analytics Tracking Code

How to set up Google Tag Manager

1. With your business Google Account go to Google Tag Manager and create a new account.

2. Enter the account name; I suggest you use your business name. Then create a container and give it a website domain name.

Google Tag Manager Property Settings

3. Then choose the type of content (Web, AMP, Android or iOS); for websites select Web. When you agree to the terms of use you will get a code snippet to add to your page header and body. Install it with the help of a plugin or put it directly into source code, depending on your site’s CMS. Here I also suggest you google how to install it correctly to your CMS.

Google Taf Manager Create Property

4. After you install the GTM code snippet to your page, you should also install the Google Tag Assistant extension for the Google Chrome browser. This extension enables you to use the Preview feature of Google Tag Manager and also shows if you incorrectly installed Google Analytics or Google Tag Manager to your page.

Google Tag Assistant

Set Up Variables in Google Tag Manager

1. Google Tag Manager workspace is roughly divided into three main sections: Variables, Triggers and Tags.Google Tag Manager Dashboard

2. I always start at the Variables menu and add built-in variables such as everything under Clicks, Videos and Scrolling.

Google Tag Manager Built In Variables

Google tag manager variables

 3. Then I create a new User-Defined Variable in Google Analytics Settings where I add Google Analytics Tracking ID. This enables me to later use this variable in Google Analytics Tags. 

Google Tag Manager Google Analytics Variable

Set Up Triggers in Google Tag Manager

After configuring Variables, I create three new triggers under the Triggers section.

1. All Clicks. Trigger type is set to “Click – All Elements” which fires on all clicks. This enables me to track all clicks on all elements on site, which is useful for tracking button clicks that do not have link attributes. 

Google Tag Manager All Click Trigger

2. All link Clicks. Trigger Type is set to “Click – Just Links” which fires on all link clicks. This enables me to track all button and image clicks which have a link attribute.

Google Tag Manager All Link Clicks Trigger

3. Scroll Depth. Trigger Type is set to “Scroll Depth” which triggers every 25% of the vertical scroll on every page. This enables me to track how deep users scrolls on our page.

Google Tag Manager Scroll Depth Trigger

Set Up Tags in Google Tag Manager

1. In order to send click and scroll events to Google Analytics, we need to set Tags on site. Go to the Tags section and create new “Google Analytics: Universal Analytics” for both of the Tags below.

2. For sending Link clicks you select Track Type to Event, Category to Link click, Action to {{Click Text}}, Label to {{Click URL}}. For Google Analytics settings you select your GA variable, that was created before, from the drop-down menu. With double brackets, you select Variables which dynamically fill values based on what users click. For Trigger select All link clicks.

Google Tag Manager All Link Clicks Tag

3. For sending Scroll Depth you select Track Type to Event, Category to Scroll Depth, Action to {{Page Path}}, Label to {{Scroll Depth Threshold}} % and you have to set Non-Interaction Hit to True, otherwise it will mess with analytics data. Then select Google Analytics Setting and Scroll Depth Trigger.

Google Tag Manager Scroll Depth Tag Set Up

4. Before you publish this configuration I suggest that you enable Preview, which you will find in the top right corner of GTM. After enabling it, go to your site and refresh it. At the bottom of your page, you should see Tag Manager Quick Preview window.

Google Tag Manager Preview Window

5. Click on the link or scroll on your page under Tags Fired On This Page section you should see two tags and if you go to Google Analytics, Real-time, Events you should also see these events.

Google Tag Manager Fired Tags Preview

Tracking Goals with Google Analytics and Google Tag Manager

1. Now let’s say that you want your user to click the button Schedule a call and you want to count how many users clicked this button. You should set this as a Goal under Google Analytics. Go to Admin, View section, Goals, New Goal. Select Custom and click Continue.

Google Analytics Goal Set Up

2. set Goal Name to “Schedule a call” and select the option Event.

Google Analytics set up Event as Goal

3. For event conditions use Category and Action as you see it under Real-time events. Save this goal. 

Google Analytics Real Time Events

Google analytics Goal CAtegory and Action set up

4. Again go to your page and click Schedule a call button and then go back to Google Analytics, Real-time, Conversions and there you should see one Goal Hit under Schedule a call goal.

Google Analytics Real TIme Conversions Check

5. If everything is OK, you should go back to Google Tag Manager, Leave Preview Mode and Submit your changes. 

Google Tag Manager Preview Tool

These are basic steps for tracking click and scroll events on your page. Google Tag Manager is a powerful tool that enables you to track many more events on your page and maybe I will present some in my future blogs. If you have any questions regarding Google Analytics or Google Tag Manager, please contact us.