Ever since Google Universal Analytics was released out of beta in early April, fans of the classic Google Analytics have been struggling to migrate to the new platform and take advantage of all its new features.
Google Analytics contains many of the features users have come to know and love, along with a bunch of new features designed to make the tool easier to use and more powerful.
As with earlier innovations, the changes inherent in Google Universal Analytics will take some time to get used to. You may need to do a bit of experimentation to get the most out of the new features, and there is a bit of a learning curve involved.
We can start our exploration of Google Analytics with one of the algorithms and some associated explanations. One of the things people worry about when migrating to the new platform is event tracking. Understanding the changes made in Google Universal Analytics is a good place to start.
Google Universal Analytics provides two ways to set up event tracking – via Tag Manager and without Tag Manager.
Google Tag Manager
Tag Manager is a handy tool for people who do not want to bother with a code. Thanks to the auto-event tracking in GTM, you may not need a code to collect the necessary information for much of your site. Let’s start with the basics of Tag Manager and then move on to the use of GTM.
Event Tracking with Universal Google Analytics
Event tracking lets you understand how users interact with the content on your site via clicks, downloads, audio and video.
In Universal Analytics, an event is defined as an interaction between the end user and the content on your site. If your site contains a button or a link to download a document, you can set up event tracking to analyze user behavior.
You can choose the event you need from a list of HTML events and select what you need based on type. For instance, you can choose mouse click, key click, form submission, etc.
Each specific event consists of four distinct components which are designed to categorize the items to be tracked.
How to Track Events
Category
A category is defined as the primary division of events you can track. You can name the categories yourself or choose a regular expression. For instance, if you track more than one PDF download or button click, you can set up separate categories and view them separately in your reports. You could name the categories PDF and Button or give them more descriptive names.
Action
An action describes what a user does within the selected category. Examples of actions include video play, download, internal link click, external link click, image enlarge, etc.
Label
A label is an optional component. You can use a label if you want to divide events and categorize them more accurately.
Value
A value is a numerical value you can set to track a specific number of actions.
Setting Up Event Tracking in Google Universal Analytics
If you want to send events to Google Analytics, you will first need to send a command to the GA function by using an event hit type. That means adding a piece of code to the element you track. If you want to track a click event from a form submission from your site, you will need to place a piece of analytic code inside the link on your webpage. That code will look something like this:
See the Pen dPMZQb by Joe Dooley (@joe-dooley) on CodePen.
If JavaScript isn’t your thing then check out the handy Event Tracking Tool from the Raven crew.
To continue, go to the Goals section in the Admin menu in Google Analytics, then click New Goal. Now highlight the last option ‘custom’ and then click ‘Next Step’ Now give enter a goal description, let’s call it Contact Form Submissions and then highlight the Events option and click Next Step
On the final step you will fill in the fields. The eventCategory will be Contact. The eventAction will be Submit and the eventLabel will be Contact Form. The eventValue is optional and should only be entered if you know the cost per lead for your website. Finally you can verify the goal before you click ‘Create Goal’ to ensure it is set up properly.
[GARD]
Event Tracking with Tag Manager
If you hate coding, this is the section for you. Many of the problems GA users encounter are related to code and scripts. Accurate GA tracking is impossible without accurate coding, and a mistake in coding can create irrelevant and misleading results. Google Tag Manager lets you get rid of all the code, replacing it with one container to hold all the necessary attributes. With Tag Manager, it is all automatic. The auto-event tracking within Tag Manager gives you everything you need with a single setup. Before we go any further, here are some terms you will need to know.
The Basics
Account – the account you use to work within Google Analytics Container – the main fragment of JavaScript code, and the only one you need to place on each page within your site. The container holds all the tags you design for tracking purposes, and it launches all other tags according to the rules you create. Macro – Macros contain two meanings – a name and value you specify to use within tags. You can use macros to add data about a user’s interaction with an element on your site. Rule – A rule is a condition that launches or blocks a tag. Tag – A tag is a piece of JavaScript like a GA code or a Google AdWords code. If you want to catch the actions of your users, you will need a combination of tags, each defined by its own rules, pre-determined events and macros in order to see it in Google Analytics. Events like clicks, downloads and form submissions would require an Event Listener tag that contains the event you wish to track, along with a rule dictating when the tag will activate. You would also need a Google Analytics tag to pass the resulting information to Google Analytics every time the Event Listener tag fires.
Tracking E-Commerce Transactions via Google Tag Manager
The algorithm needed for e-commerce is quite simple, but the details depend on a number of factors, including the structure of your online store and which pages include the GTM container. You may choose to include the GTM container on the final “Thank you” page in your sales funnel, on a button or on any other type of page. We will use the “Thank you” page as an example. To create this we will: Add the required e-commerce transaction information using the data layer above the Google Tag Manager container.
- Create a Google Analytics GTM tag with a transaction
- Set the rules that cause it to fire
- Check your e-commerce settings in Google Analytics
- Check your reports
To view purchase data in Google Tag Manager, you would use a data layer along with a specific order of data transmission based on the GTM Data Layer instructions. It is a good idea to use optional parameters as well as required ones. Adding optional parameters will make your finished reports more useful and allow you to more precisely segment your data and analyze your sales. The data layer elements must be initialized on the page by placing the following code snippet either in the head section or any place above the GTM container code: This tag must be placed before the Google Tag Manager script on your website See the Pen jEqaQa by Joe Dooley (@joe-dooley) on CodePen.
The GTM container is simply an empty object which is filled with the information you need to pass to GTM. This data is used to indicate the data variables, subcategories, product types, etc. Setting up this container is optional, but it will be very helpful when analyzing your reports.
An example of code that could be placed on one of your ‘thank-you’ pages might be:
This tag must be placed before the Google Tag Manager script on your website
See the Pen myPqaV by Joe Dooley (@joe-dooley) on CodePen.
The next step is to create the Google Analytics tag. Just go to Google Tag Manager and create a new Universal Analytics Tag or Classic depending on your Analytics version and select the Transaction Track type:
Now we will create a rule so the Transaction tag fires only on your ‘Thank You’ page. Click on Rules on the left and then click create new rule.
Under Rule Name give your rule a name and then enter the url of your thank you page and set it up like the image below.
If you want the GTM tag to fire based on something else check out the Google Tag Manager developer guide.
Recap
Google Tag Manager uses all aspects of website tracking, and developers are constantly discovering and rediscovering its new features and benefits. If you want to make money online, you need to carefully track as much data as you can. That means tracking unique visitors, users, pages visited, clicks and views. The tools used to track that vital data are constantly changing and evolving, and you need to keep adapting to those changes as they come.
If you are interested in Event Tracking and would like to have it set up on your own website let me know.