As analysts, we oftentimes 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 data in spreadsheets to provide insights made from reliable, relative information.
Avoid these inefficiencies by learning 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 through 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 configured through your GA settings. There’s a section within secondary dimensions solely dedicated to custom dimensions, once enabled.
Custom dimensions allow you to view additional data points or pieces of information alongside GA's default hits. For example, you could view the author of a blog post next to every hit associated with that blog or stitch together individual user behavior by sending User IDs along with every hit sent by that user. Additionally, even default hits are not available for viewing in every GA report, but can be through custom dimensions.
Custom dimensions are boundless, allowing you to pull any piece of information found on a page, in the page source, in a dataLayer, URL, or GTM variable 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 covering how to configure custom dimensions 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 having your custom dimension data properly attributed to hits in your GA 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 is for eCommerce tracking. This type of tracking only assigns a value to a 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 “Yes” or “No” for the dimension “Comment Left” 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 be useful to view this sort of isolated data along with every hit in the session.
Session level scopes should be set when you want to know all of the interactions that occurred within a session during which a 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 applies 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 configured 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 custom dimensions in Google Tag Manager is much easier to do than it is to understand how it works. It’s actually quite simple, if you already have variables and custom 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.
- Add a custom dimension. Define the dimension’s name, specify the scope type, and make sure ‘Active’ is checked.
- 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). The dimension number ‘1’, taken from where it says ‘dimension1’ in the highlighted box, is what associates the custom dimension name you just set with the index you’ll set in GTM.
- Create your variable in GTM. Skip this step if you have already created your custom variables. This step will vary depending on the type of variable
- Set the field name and value in your GA variable. Your Google Analytics property must be tracked through a Universal Analytics tag in GTM to set up custom dimensions with this method. Expand the ‘More Settings’ field in your existing GA variable in GTM and set your ‘Field Name’ to match the name you defined in your custom dimension setting in GA. Then set the ‘Value’ field as the variable you are using to push values to GA.
- Set the index and value under ‘Custom Dimensions’. Set the ‘Index’ to the number you noted from the code that GA created for you when you created your custom dimension. Then, set the same variable that pulls in the values you want sent to GA as the
- Preview, test, publish, and analyze! (Then refine if need be.)
How do you use custom dimensions to reduce inefficiencies in reporting? Comment below to share ideas on how to customize data collection in GA!