How to Use Custom Dimensions and Metrics in Analytics

How to Use Custom Dimensions and Metrics in Analytics

Custom dimensions and metrics are vital tools in Google Analytics that allow you to tailor your data collection to suit your specific business needs. By implementing custom dimensions and metrics, you can gain deeper insights into user behavior, track unique aspects of your business, and improve your overall reporting capabilities. Here’s a step-by-step guide on how to effectively use custom dimensions and metrics in Analytics.

What Are Custom Dimensions and Metrics?

Custom dimensions are attributes that you can define to segment your data. They provide context to standard metrics and can help you organize your data meaningfully. For example, you can create a custom dimension to track user roles, product categories, or logged-in status.

Custom metrics, on the other hand, let you measure unique data points pertinent to your business. They allow you to collect values for specific events or interactions that aren't already automatically tracked by Google Analytics, such as purchases or user engagement metrics.

Setting Up Custom Dimensions and Metrics

To start using custom dimensions and metrics in Google Analytics, follow these steps:

1. Define Your Needs

First, identify what additional data you want to track. Consider your business goals and what specific user interactions are relevant to your analysis. This step is crucial as it determines how you will configure your custom dimensions and metrics.

2. Access Admin Settings

Log into your Google Analytics account and navigate to the Admin section. Under the property column, click on "Custom Definitions," where you will find options for "Custom Dimensions" and "Custom Metrics."

3. Create Custom Dimensions

Click on "Custom Dimensions" and then the "+ New Custom Dimension" button. Fill in the details:

  • Name: Choose a descriptive name for your dimension.
  • Scope: Select the scope (User, Session, Hit, or Product) depending on when you want the dimension to apply.
  • Active: Ensure this is checked to collect data immediately.

After filling in the necessary details, click "Create" to save your custom dimension.

4. Create Custom Metrics

Similarly, go to "Custom Metrics" and click on "+ New Custom Metric." Enter the required details:

  • Name: Clearly label what metric you want to track.
  • Formatting Type: Choose the type of data this metric will represent (e.g., integer or currency).
  • Scope: Again, select the appropriate scope.
  • Active: Make sure to check this option.

Click "Create" once you have entered all necessary information.

Implementing Custom Dimensions and Metrics

After setting up your custom dimensions and metrics, you need to implement them in your website’s code or via Google Tag Manager:

Using Google Tag Manager

If you’re using Google Tag Manager, you can set custom dimensions and metrics by creating variables. Here’s how:

  • Navigate to your Google Tag Manager account.
  • Create a new variable using the type that corresponds to your data source (e.g., Data Layer Variable).
  • For each tag configured to send data to Google Analytics, include your custom dimension and metric by adding them in the respective fields.

Using Tracking Code

If you prefer manually adding tracking code, you can include your custom dimensions and metrics directly in your analytics.js code. Here’s an example:

ga('set', 'dimension1', 'UserRole'); // For a custom dimension
ga('send', 'event', 'Video', 'play', { 'metric1': 1 }); // For a custom metric

Analyzing Your Data

Once you have implemented your custom dimensions and metrics, it’s time to analyze your data:

  • Go to the "Custom Reports" feature in Google Analytics to create reports that include your custom dimensions and metrics.
  • Utilize the "Segmentation" feature to segment your audience based on your custom dimensions for deeper insights.
  • Leverage real-time analytics to observe how your custom metrics reflect user actions instantly.

Best Practices for Using Custom Dimensions and Metrics