How to set up Custom Dimensions

Overview

Custom dimensions are similar to default dimensions except that you define what they are and their value. This let’s you collect data that’s customized specifically for your business. This can be incredibly powerful because it enables you to report on particular characteristics of your users or their behavior within the Google Analytics data you’ve collected.

You collect data for a Custom Dimension using JavaScript tracking code that’s implemented on a page. When a user lands on that page or performs a specific action, the Custom Dimension will capture that data and send it over as an additional parameter attached to the existing hit. You can then use these Custom Dimensions in your reports.

For example, the Google Merchandise Store can use a Custom Dimension to capture whether users are retail customers or Google employees. The Store has set up a special URL for employees to click on that identifies them as internal and applies an employee discount.

Set up 

To set up a Custom Dimension, go into Admin. Select the Property in which you want the dimension applied. Next, click “Custom Definitions” and then “Custom Dimension.” Then click “New Custom Dimension.”

You’ll first have to name the Custom Dimension and then define its scope. Remember that dimensions can have a scope of “hit,” “product,” “session,” or “user.” This is based on how broadly you want to categorize your metric data.

For example, if you want the dimension to include every time a user visited a particular page or performed a singular action, you will need to set a hit-level scope. If you want the dimension to group data associated with a particular product, you will set a product-level scope. If the dimension was organizing data for the duration of a session or for a particular user, you can set session- and user-level scopes, respectively.

Like standard dimensions and metrics, Custom Dimensions and Metrics can only be paired with dimensions or metrics from a similar scope. Since the Google Merchandise Store wants to track whether users are employees or not, it makes sense to set the scope of this Custom Dimension as “user.”

Note the default checkbox to make the dimension active.  You can make Custom Dimensions inactive at any time by unchecking this box. Any Custom Dimension data already collected and processed will appear in reports, but no data will be collected once the dimension has been made inactive. To save the Custom Dimension, click “Create.”

When you create a Custom Dimension for the first time, you’ll be taken to a screen with JavaScript to include on your website. You can copy the code, then click “Done.”

You’ll be taken to an overview screen where you can see all of the Custom Dimensions that you have set up in that property. Notice that, similar to Goals, Google Analytics assigns an index (or slot number) for each Custom Dimension you create. Note that you cannot choose which index number is assigned; they are assigned in the order you created them.

After you’ve set up the Custom Dimension, you must implement the JavaScript tracking code you copied from Analytics into your website code to collect the custom data. Different businesses will do this in different ways, depending on their data collection method and what data they wish to collect. Google Tag Manager is a great option for managing Custom Dimension tracking code more easily.

The Google Merchandise Store will use JavaScript to track whether employees came from the employee discount link. If they did, then the code will pass an employee value into the Custom Dimension tracking code on the page. If users arrive at the website without going through the link, the code will pass a retail-customer value into the Custom Dimension.

The Custom Dimension tracking code then picks up these values from the JavaScript code and attaches this dimension data in the pageview hit that users first triggered when they arrived on the page. “dimension1” refers to the index number of the Custom Dimension created in Analytics. The “userStatus” variable is what the Store’s custom Javascript code passes to the Custom Dimension to use in reports.

When the custom JavaScript collects whether users came from the discount URL link or not, it will populate that index and value variable with the user status.

Once the hit has been sent to Google Analytics, Analytics will process that data into a Custom Dimension that may be applied to reports to compare customer and employee behavior.

Using Custom Dimensions in your reports

You can use Custom Dimensions as secondary dimensions in standard reports or as primary dimensions in Custom Reports (which we’ll discuss later). For example, if the Google Merchandise Store wanted to see which products were most popular among employees and retail customers, we can open the Product Performance report under Conversions in Ecommerce and add the secondary dimension we set up of “User Category.” 

Note that you won’t be able to apply a Custom Dimension to data you have previously collected. You’ll have to create the Custom Dimension first and let it be applied to your data during processing in order to use it in reports. At this time, standard Google Analytics users can create up to 20 Custom Dimensions and Analytics 360 customers can create up to 200. We’ll look at how to use Custom Dimensions in your analysis a little later.
 

Was this helpful?

How can we improve it?
true
Choose your own learning path

Check out google.com/analytics/learn, a new resource to help you get the most out of Google Analytics 4. The new website includes videos, articles, and guided flows, and provides links to the Google Analytics Discord, Blog, YouTube channel, and GitHub repository.

Start learning today!

Search
Clear search
Close search
Main menu
9576003875330467671
true
Search Help Center
true
true
true
true
true
69256
false
false