- March 13, 2018
- April 18, 2017
As analysts, we can find ourselves spending nearly as much time collecting data as we do actually analyzing it. Default reports in Google Analytics don’t always let us compare the right metrics against each other easily. So we gather, combine, and sort through the data in sheets to find insights made from reliable, relative information. However, there are plenty of situations where this inefficiency can be avoided. This post will teach you what custom dimensions are and how to set them up through Google Tag Manager.
What is a Custom Dimension?
Non-standard data can be pulled into your GA reports and synced up with metrics in whichever scope type is specified (and feasible). This may sound familiar to you; do Secondary Dimensions ring a bell?
Custom dimensions are essentially custom secondary dimensions that are pulled in through your GTM container, which extracts information and sends it along to GA. There’s a section within secondary dimensions solely dedicated to custom dimensions. Here’s an example of a secondary dimension pulled into a GA report:
But wait!—If you can automatically pull in your event values that are set up in your GTM container, why do you have to set up custom dimensions separately? Great question . Custom dimensions are ideal for pulling in additional pieces of information that offer no benefits being registered as a separate hit or event (ex. query parameters in a URL string, the author of a post on your site, or User ID number). Additionally, GTM event values are not easily viewable in some GA reports, such as at the page level in your All Pages report.
Custom dimensions allow you to merge any data that can be pulled into a dataLayer, found in the URL, made into a GTM variable, or located on the page or within the page source, into your Google Analytics reports.
Custom dimensions are made up of the following elements:
- Index: the identifying number for your values
- Values: the specified data that’s sent
- Scopes: the type of value that’s collected
- Variables: what collects your value in GTM
Before we jump into how to configure a custom dimension through Google Tag Manager, we’ll cover what scopes are and how to select the correct type. Choosing the proper scope type is vital to getting your custom data associated with all metrics possible in your reports.
Custom Dimension Scope Types
There are four scope types you can specify for custom dimensions; all of which will provide varying levels of depth in your reports. The following scopes are listed in order of lowest to highest number of values sent.
The product level scope only assigns a value to that specific product and can only pull in data if enhanced eCommerce tracking is enabled. It can pull in a value associated with that product when you’re looking at a specific pageview or transaction but it won’t tie this product’s specific value to the rest of the hits in your session.
The benefit this provides is the ability to look at your product-related data in nearly any GA report without having to stay within your Product report or set up custom events.
The hit level value is only applied to the specified hit. No hit before or after this specified hit will have this custom dimension associated with it—even within the same session.
For example, you could set up a hit level scope to send a value of “comment left on blog post” to see which posts have received comments within your GA reports. This value would be sent for just a view or entrance of that blog post page and none before or after within the same session. Although you could set it up to be a session level scope, it wouldn’t provide you the most accurate data if it simply sent a value of “comment left on blog” on every page the user visited throughout the session.
Session level scopes should be set when you want to know all of the interactions that occurred within a session during which one specified action occurred. The value that’s set will apply to all hits in the same session that took place before and after the value is triggered to send.
It’s important to highlight the “before and” part of this scope. Let’s say you set a value to be sent when a user visits the checkout page. Any hits that happened before they visited the checkout page will also have this value tied to them in your GA reports.
At first, the data collection would look like this:
The hit occurs and that value is sent to GA. Then it retroactively goes back to Hit 1 and ties that same value to the previous hits and every hit thereafter in the same session.
In addition, the last hit that occurs in a session scope takes precedence. If two different values are specified to send data to GA and both of these are triggered within the same session, the last value sent will override all other values in that session.
Building onto the previous example where a specified hit already occurred and was applied to every other hit within that session (all hits filled green for Value: A)—let’s say another value was triggered to send on the last hit below within the same session (Hit 4 filled red for Value: B).
That hit that was triggered will send Value: B to every hit that had Value: A originally applied to it within the same session. Note: You won’t receive two values (A and B) along with every hit in this session, Value: B will override Value: A and all hits will be tied to Value: B.
User scope is the highest scope level you can set for a custom dimension. So setting this scope will send the most values tied to successive hits to GA—only if it’s a feasible scope to apply to the values you are attempting to pull into your reports.
In a user level scope, all hits in a session during which a specified hit occurs, and all hits in every session afterward, will be associated with the same value. In the example below, the action that triggers the value didn’t occur in Session 1; therefore, no values are tied to any hits in Session 1. However, the value is triggered to send sometime in Session 2, so all hits in Session 2, Session 3, and thereafter are tied to the sent value.
The prime example for this is User ID tracking. If User ID tracking is set up on a site with a custom dimension applied at a user scope level, once the user logs into the site, every hit in every session afterwards will have their User ID tied to it. If you set up User ID tracking as a custom dimension at a hit level, you would only get the User ID value tied to the first hit that occurred with the user logged into the site—resulting in the missed opportunity for stitched session reports.
How to Set Up a Custom Dimension
Setting up a custom dimension in GA is easier to do than it is to understand how it works. It’s actually quite easy! (If you already have the variables and tracking set up in GTM.)
Steps to setting up a custom dimension through Google Tag Manager:
Create a custom dimension in GA. Go to ‘Custom Dimensions’ under Admin > Property Settings > Custom Definitions.
- Take note of the dimension number. GA will create a custom tracking code for those setting this up through hard-coding (which we are avoiding by setting it up in GTM).
- Create your variable in GTM. Skip this step if you already have the variable you want created and are ready to track! This part will depend on whether you’re identifying a variable in:
Define the dimension’s name, specify the scope type, and make sure ‘Active’ is checked.
- A part of a URL parameter (explore the default URL variable options for this one; the data you want may already be configured to be grabbed easily)
- A dataLayer variable
- Default GTM variables
- Any other custom-configured variables in GTM
How do you use custom dimensions to reduce inefficiencies in reporting? Comment below for advice on how to set up specific custom dimensions you have in mind!