What are Custom Dimensions and How Do You Use Them?
Custom Dimensions in Google Analytics allow you to track and analyze data that isn’t included in the standard tracking metrics provided by Google Analytics. They give you the flexibility to collect and view custom data about your website or app, helping you gain insights that are more relevant to your specific business goals. This is especially useful when the standard dimensions (e.g., pageviews, session duration) don’t provide all the information you need.
Here’s a detailed explanation of what custom dimensions are, and how to set them up and use them effectively.
What are Custom Dimensions?
A dimension in Google Analytics refers to an attribute of data, such as the page URL, user location, or device type. A custom dimension allows you to track additional attributes about users or their behavior that Google Analytics doesn’t automatically track.
For example, with custom dimensions, you could track:
- User roles (e.g., admin, customer, subscriber).
- Logged-in vs. guest users.
- Content type (e.g., blog post, product page).
- Customer lifetime value.
Why Use Custom Dimensions?
Custom dimensions are valuable for tracking specific metrics that are relevant to your business. They allow you to:
- Segment data by specific characteristics that aren’t available in the default dimensions.
- Track custom user behavior (e.g., identifying users who have completed specific actions on your website).
- Tailor your reports based on unique information about your users, products, or services.
- Enhance your data analysis by gathering deeper insights into user engagement and behavior.
How to Set Up Custom Dimensions in Google Analytics
To use custom dimensions, you need to configure them both in Google Analytics and your website or app’s tracking code (typically through Google Tag Manager or directly in the tracking script).
Step 1: Create Custom Dimensions in Google Analytics
- Log into Google Analytics and navigate to the account/property where you want to create the custom dimension.
- Go to the Admin section (click the gear icon in the bottom-left corner).
- Under the Property column, click Custom Definitions and select Custom Dimensions.
- Click the + New Custom Dimension button.
- Name your custom dimension (e.g., “User Role”, “Content Type”).
- Choose the Scope:
- Hit: Applies to a single action (e.g., pageview, event).
- Session: Applies to all actions within a single session.
- User: Applies to all sessions by a specific user.
- Product: Applies to products in eCommerce tracking.
- Check the box to Activate the custom dimension.
- Click Create.
Google Analytics will generate an Index Number for the custom dimension, which is necessary for setting it up in the tracking code.
Step 2: Add Custom Dimension to Your Tracking Code
To ensure the custom dimension is being tracked on your website or app, you need to modify your tracking code or Google Tag Manager setup. There are two common methods for adding custom dimensions: directly in the tracking code or using Google Tag Manager.
Option 1: Using Google Tag Manager
- Log into Google Tag Manager.
- Select the container for your website.
- Go to Tags and choose the tag where you want to add the custom dimension (this will typically be your Google Analytics tag).
- In the Tag Configuration, look for the Google Analytics Settings field.
- Scroll down and click More Settings.
- Click Custom Dimensions.
- Enter the Index Number from Google Analytics and the Dimension Value (the value you want to track, such as “User Role”).
- Save and publish your changes in Google Tag Manager.
Option 2: Directly in the Tracking Code
If you’re using the tracking code directly on your site, you can add the custom dimension to your gtag.js or analytics.js tracking code:
For gtag.js, add:
‘custom_map’: {‘dimension1’: ‘user_role’}
});
gtag(‘event’, ‘login’, {
‘user_role’: ‘admin’
});
For analytics.js, add:
ga(‘set’, ‘dimension1’, ‘admin’);
ga(‘send’, ‘pageview’);
Step 3: Verify the Custom Dimension is Working
Once you’ve implemented the custom dimension in your tracking code or through Google Tag Manager, you should verify that the data is being collected:
- In Google Analytics, go to the Real-Time reports.
- Perform the action that triggers the custom dimension (e.g., log in as an admin user).
- Check if the custom dimension value appears under Real-Time > Events or Real-Time > Overview.
How to Use Custom Dimensions in Reports
Once your custom dimension is properly set up and data is being collected, you can use it in reports:
Step 1: Create a Custom Report
- In Google Analytics, go to the Customization section in the left sidebar.
- Click on Custom Reports > New Custom Report.
- Name your report and add metrics (e.g., pageviews, sessions).
- In the Dimension dropdown, select your custom dimension (e.g., “User Role”).
- Save and view the report to see data filtered by the custom dimension.
Step 2: Use Custom Dimensions in Segments
- In any Google Analytics report, click on Add Segment at the top of the report.
- Click + New Segment.
- Under Conditions, choose your custom dimension (e.g., “User Role”).
- Set the condition (e.g., “User Role = Admin”).
- Save the segment, and it will apply to the report.
Practical Examples of Using Custom Dimensions
- Tracking User Roles: If you run a membership site, you can create a custom dimension to track different user roles (e.g., admin, member, guest) and see how their behavior varies.
- Content Categories: Use a custom dimension to track which content categories (e.g., blog, product reviews) perform best in terms of engagement or conversions.
- Marketing Campaign Performance: Add custom dimensions to track internal campaign types (e.g., holiday sales vs. regular sales) and analyze their effectiveness.
- Logged-in Users vs. Guests: Create a custom dimension to compare the behavior of logged-in users versus guest users on your site.
Conclusion
Custom dimensions in Google Analytics are a powerful way to extend your tracking and gain insights beyond the standard data collection. By defining your own dimensions based on user attributes or behaviors, you can tailor your analytics to your specific business needs, gaining valuable insights to improve user experience and drive business growth.