Google Tag Manager & Analytics Enhancements
Useful abbreviations we’ll be using throughout this article:
- GTM - Google Tag Manager
- GA - Google Analytics
This is an overview of the GTM Data Layer, the relationship between GTM and GA, and custom event tracking. GTM is used to manage many different 3rd party tags. There are a lot of great resources available on the web that walk through this general use of GTM which we will not cover in this article.
In most cases, you will never need to copy any Javascript into your site to setup GTM, GA, or custom dimensions. This is already configurable and available through the ePublishing platform.
Setup GTM
To enable GTM on your website, go to the system setting google.tag.manager.container.id and set the value to your GTM account ID.
With GTM enabled, you must use Google Analytics within GTM. Remove the GA ID from the system setting google.analytics.universal.identifier and google.analytics.identifier.
We will not cover setting up Google Analytics in GTM within this article. If you need assistance with that, we recommend this helpful video: https://www.youtube.com/watch?v=28d60ejfk3s
The Data Layer
Google defines a data layer as "an object that contains all of the information that you want to pass to Google Tag Manager. Information such as events or variables can be passed to Google Tag Manager via the data layer, and triggers can be set up in Google Tag Manager based on the values of variables (e.g., fire a remarketing tag when purchase_total > $100) or based on the specific events. Variable values can also be passed through to other tags (e.g., pass purchase_total into the value field of a tag)."
Here is a list of data ePublishing provides through the Data Layer for any given page:
- ID
- Topics
- Keywords
- Page_type
- Date_posted
- Gated
- Registered
- Microsite
- Author
- Sponsored
- Sponsored_advertiser_name
- Directory_company_name
- Directory_name
- Directory_level
- Directory_category
An e-commerce transaction includes additional data:
- event name “transactionComplete”
- transactionId
- transactionAffiliation
- transactionTotal
- transactionTax
- transactionShipping
- transactionProducts
Each order item passes the sku, name, category, price, and quantity to the Data Layer.
To take advantage of the Data Layer within Google Analytics reporting, you will need to configure both GTM and GA to share this data using Custom Dimensions. https://community.canvaslms.com/docs/DOC-12568-google-analytics-custom-dimensions-through-google-tag-manager
With Custom Dimensions and the Data Layer, you can generate reports based on any of those data points listed above.
Custom Event Tracking
To take advantage of enhanced analytical tracking, it may require custom development to pass the necessary data to GTM. Please contact your Project Manager to inquire about this solution.
We track a series of components (including but not limited to the sidebar, homepage, article template) which identify the title, image, headline, author, topics, links that were clicked, and much more. This allows you to determine when an article headline was clicked from the featured story section on the homepage versus from the sidebar on an internal page, thereby gaining an understanding of where your users are most engaged with your site.
Other events we are tracking through GTM:
- Carousel events (when a user interacts with a slideshow, the content and position of the slide is recorded)
- Email links
- Outbound links
- PDF links
- Podcast plays
This type of data helps you identify what’s funneling your users into a given piece of content, and helps us make more informed design decisions around the UX / UI of your site.
Using our general event click tracking, you can add a set of HTML data attributes to any link to begin tracking. When a user clicks on any type of element with these attributes, an event is pushed to GA. For example, within an Editorial Content area in the Admin tools you could create a link with these data attributes to begin tracking its conversions.
<a href=“/custom-page” data-eventname=“ec-custom-page-link” data-eventcategory=“click” data-eventaction=“ec-custom-page-link” data-eventlabel=“My Custom Link”>My Custom Link</a>
- data-eventname: Used to name the event, this is only referenced when you wish to disable a specific component from being tracked.
- data-eventcategory: We recommend well organized categories. This is the GA Event Category field. Most events are categorized under “click” as a general type of event.
- data-eventaction: This is the GA Event Action field.
- data-eventlabel: This is the GA Event Label field.
You will find all of these tracked events in GA under Behavior then Events. Here’s an example report of the total number of events categorized as “click”: