Test your skills on our all Hosting services and get 15% off!

Use code at checkout:

Skills
21.10.2024

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

  1. Log into Google Analytics and navigate to the account/property where you want to create the custom dimension.
  2. Go to the Admin section (click the gear icon in the bottom-left corner).
  3. Under the Property column, click Custom Definitions and select Custom Dimensions.
  4. Click the + New Custom Dimension button.
  5. Name your custom dimension (e.g., “User Role”, “Content Type”).
  6. 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.
  7. Check the box to Activate the custom dimension.
  8. 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
  1. Log into Google Tag Manager.
  2. Select the container for your website.
  3. Go to Tags and choose the tag where you want to add the custom dimension (this will typically be your Google Analytics tag).
  4. In the Tag Configuration, look for the Google Analytics Settings field.
  5. Scroll down and click More Settings.
  6. Click Custom Dimensions.
  7. Enter the Index Number from Google Analytics and the Dimension Value (the value you want to track, such as “User Role”).
  8. 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:

gtag(‘config’, ‘UA-XXXXXX-Y’, {
‘custom_map’: {‘dimension1’: ‘user_role’}
});
gtag(‘event’, ‘login’, {
‘user_role’: ‘admin’
});

For analytics.js, add:

ga(‘create’, ‘UA-XXXXXX-Y’, ‘auto’);
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:

  1. In Google Analytics, go to the Real-Time reports.
  2. Perform the action that triggers the custom dimension (e.g., log in as an admin user).
  3. 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

  1. In Google Analytics, go to the Customization section in the left sidebar.
  2. Click on Custom Reports > New Custom Report.
  3. Name your report and add metrics (e.g., pageviews, sessions).
  4. In the Dimension dropdown, select your custom dimension (e.g., “User Role”).
  5. Save and view the report to see data filtered by the custom dimension.

Step 2: Use Custom Dimensions in Segments

  1. In any Google Analytics report, click on Add Segment at the top of the report.
  2. Click + New Segment.
  3. Under Conditions, choose your custom dimension (e.g., “User Role”).
  4. Set the condition (e.g., “User Role = Admin”).
  5. Save the segment, and it will apply to the report.

Practical Examples of Using Custom Dimensions

  1. 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.
  2. Content Categories: Use a custom dimension to track which content categories (e.g., blog, product reviews) perform best in terms of engagement or conversions.
  3. Marketing Campaign Performance: Add custom dimensions to track internal campaign types (e.g., holiday sales vs. regular sales) and analyze their effectiveness.
  4. 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.

Test your skills on our all Hosting services and get 15% off!

Use code at checkout:

Skills