Custom Definitions in Google Analytics 4: Why they are Essential for an eCommerce Business

Posted on 2023-10-19


If you like money, you should also learn to like data, as it helps you make more money. Custom definitions in Google Analytics 4 can provide you with data.

Which means they can help you make more money.

money lover

Custom definitions are a powerful option for eСommerce businesses looking to gain deeper insights into their customers' behavior. By creating custom definitions, you can tailor your analytics to your unique needs and goals. This will make it easier to carry out informed decisions about your marketing strategies.

In this article, we'll explore what custom definitions are, why eCommerce businesses need them, and how you can use them to improve your analytics.

We will also tell you how to create custom dimensions and custom metrics. Whether you're new to Google Analytics 4 or an experienced user looking to take your eCommerce analytics to the next level, this article will provide valuable insights and actionable tips. So, let's dive in!

What are Custom Definitions?


Custom definitions enable you to tailor your analytics to your unique business needs and goals by defining your own dimensions and metrics.

Custom definitions are exclusive to your business and are not available to others. You can't use custom definitions you create in a different GA4 property.

For example, you can create a custom definition to track the product category, color, or size that is added to a customer's cart. You can also create one for the total discount that is applied to the order or the revenue generated from a particular product category. To analyze your customer behavior, you can implement the 'user id' custom dimension at the user scope. This level of granularity allows you to gain insights into customer behavior that would otherwise be difficult to track.

What is the Difference Between Custom Definitions in GA4 and Universal Analytics?

In Universal Analytics, custom definitions were known as custom dimensions and metrics. Like GA4's custom definitions, they enabled you to track specific metrics that are not captured by default.

If you have used custom definitions in Google Analytics' previous installment, there are now a few differences you should be aware of.

1. They are now created at a different level

In Universal Analytics, custom dimensions and metrics could only be created at the property level. They were shared across all views within that property. In contrast, GA4's custom definitions are created at the measurement level, allowing for greater flexibility and customization.

2. They work with event-based data

Custom dimensions and metrics in Universal Analytics had four scopes - hit, session, user, and product. GA4's custom definitions are designed to work with event-based data. Session-based custom definitions are not as effective as they were in Universal Analytics. This means that in GA4 you have more flexibility to track specific actions but only event and user scoped, such as button clicks or form submissions.

3. You can have more of them

Additionally, in Universal Analytics, custom dimensions and metrics had a set number of slots available. You could create up to 20 custom dimensions per property, with each slot corresponding to a specific index. In GA4, limits are increased significantly - you can create up to 50 event-scoped custom dimensions, 50 event-scoped custom metrics, 25 user-scoped custom dimensions and 10 additional item-scoped dimensions are available.

How Do Custom Definitions Benefit eCommerce Businesses?


Custom definitions can benefit eCommerce businesses in several ways. By enabling you to track specific metrics and customer segments, custom definitions provide deeper insights into customer behavior. This in turn can help you make more informed decisions about your marketing strategies. Here are some examples of how custom definitions can help eCommerce businesses:

1. Tracking Customer Behavior:

Custom definitions allow you to track specific customer behavior, such as the types of products added to a cart, their color or size, or the time spent on a particular page. This level of granularity enables you to understand customer behavior patterns and tailor your marketing strategies accordingly.

2. Segmenting Customer Data:

Custom definitions enable you to segment your customer data based on specific criteria, such as demographics, behavior, or purchase history. This allows you to identify high-value customer segments and tailor your marketing strategies to their specific needs.

3. Optimizing Campaigns:

With custom definitions, you will be able to better track the performance of your marketing campaigns and optimize them for better results. For example, you can create a custom definition to track the revenue generated by a particular campaign or the number of new customers acquired.

4. Improving User Experience:

Custom definitions enable you to track user behavior on your website and identify areas for improvement. For example, you can track the time spent on a particular page or the number of clicks on a specific button, and use this data to optimize your website for a better user experience.

Types of Custom Definitions for eCommerce Analytics

ECommerce businesses can use several types of custom definitions in Google Analytics 4 to track specific dimensions and metrics that are important to their business goals. Below are some of the most common types of custom definitions used by eCommerce businesses, along with examples of how each can benefit an online store.

1. Custom Dimensions for Product Performance

You can use custom dimensions to track specific product attributes such as color, size, or category. By using custom dimensions to track these attributes, eCommerce businesses can gain insights into which products are most popular and which attributes are most important to their customers. Also, you can implement content grouping by the product categories that you have and then register it as a custom dimension.

For example, an online clothing store could create a custom dimension value to track the popularity of different clothing sizes. The data gained can allow them to optimize their inventory and product offerings.

2. Custom Metrics for Revenue and Sales Funnel Analysis

Custom metrics can be used to track specific revenue-related metrics such as average order value, conversion rate, and even the total amount of discount applied to the order. Using custom metrics to track these things, you can better analyze how your sales funnel is performing and where you can optimize your revenue streams.

For example, you can use custom metrics to track the conversion rate of the checkout process. You can then use the data you've gained to identify areas where customers are dropping off and make improvements to increase revenue.

3. Custom Dimensions for Customer Segmentation

Custom dimensions can also track customer attributes that are not included in default reports, such as user behavior on specific pages or user preferences. Even more - when implementing the User ID feature, you can register a custom dimension for it and investigate what certain users buy or do not buy, and how they interact with your website.

But remember about PII here - avoid sending personal information to GA4. Just send some unique identifier only, for example, a customer ID generated by your CRM system. With this, eCommerce businesses can gain even deeper insights into their customers and tailor their marketing efforts accordingly.

As an example, you can use a custom dimension to track which product pages your customers are spending the most time on. This will let you identify which product categories draw the most interest. On the other hand, this could help you identify problems with your web design. If customers spend too much time looking around and too little buying, there are probably areas you can improve.

How to Set Up Custom Definitions in Google Analytics 4 for eCommerce Sites

Here are the steps involved in setting up custom definitions for eCommerce sites:

1. Identify Your Key Dimensions and Metrics:

Before setting up custom definitions, identify the key dimensions and metrics that you want to track. These metrics should align with your eCommerce goals, such as revenue, conversion rate, or average order value.

2. Send definition to GA4:

You can use Google Tag Manager to send your custom definition as an event parameter or user property to GA4. Here's an example where we send order discount value as a purchase event parameter with a purchase tag in GTM.


3. Test and Verify:

Once you've implemented sending your definition test you need to verify that it is working properly. Use GTM preview mode and/or the DebugView section in your GA4 property.

Here's an example of debugging user id as a user property in GA4:


Check that the data is being captured and displayed correctly in your Google Analytics 4 reports.

4. Register your custom definition:

Create custom definitions for each one using the Google Analytics 4 user interface. For this, open Custom Definitions in the Admin section of your GA4 property. Select either custom definitions or metrics and press 'Creare custom metrics'.


Enter your metric name (the name you want to use further in your reports) and the description that will specify this metric for other users of your analytics property. Then select or enter the event parameter for this definition and unit of measurement.


Congratulations! In 24 hours you will be able to use this custom metric in your GA4 reports.

Tips and Best Practices for Custom Definition Setup:

Define Your Objectives:

Before creating custom definitions, define your objectives and identify the key dimensions and metrics that you want to track. This will help you create custom definitions that align with your eCommerce goals.

Keep it Simple:

Avoid creating too many custom definitions, as this can lead to confusion and data overload. Focus on the dimensions and metrics that are most important to your eCommerce business and create custom definitions for those.

Use Descriptive Names:

Use descriptive names for your custom definitions to make it easy to understand their purpose and use. This will make it easier for you and other GA4 property users to identify and analyze the data associated with each custom definition.

Test and Verify:

Always test and verify that your custom definitions are working correctly before relying on the data for decision-making. This will ensure that you are making informed decisions based on accurate data.

How to track Custom Definitions


Once you've set up your custom definitions, it's essential to track and analyze the data associated with them. Here are appropriate custom dimensions and metrics that eCommerce businesses should include when setting up custom definitions in Google Analytics 4:

1. Product and Category Custom Dimensions:

By creating custom dimensions for products and categories, eCommerce businesses can gain insights into which products and categories are performing well, and which ones are not. This data can help businesses optimize their product offerings and improve the user experience.

For example, tracking the custom dimension "product type" can help you identify which types of products are most popular and adjust your product offerings accordingly. Similarly, tracking the above-mentioned custom dimension "content_group" can help you identify which categories are driving the most revenue and optimize the category pages.

2. Audience Custom Dimensions:

You can configure custom dimensions related to customers to capture data not covered by standard reports.

You can create a custom dimension "product category interest" to track which product categories customers are most interested in. This can help you personalize your marketing campaigns to target customers with specific product offerings they are most likely to be interested in.

Here is another example of a custom dimension that can describe your audience:

When you have a website with multiple stores located in different regions, you can send the event parameter, for example, 'branch_name', and register it as the custom dimension "Store location". That will give you an opportunity to build specific audiences or analyze customer behavior across each or all stores simultaneously.

3. Custom Metrics:

Custom metrics are user-defined metrics that enable businesses to track unique KPIs that are not available in Google Analytics 4 out-of-the-box. Custom metrics can help you track unique KPIs that align with your eCommerce goals to improve your decision-making.

Following with the example above, tracking the custom metric "store purchasers" can help you identify your most valuable stores and optimize their strategies. Similarly, tracking the custom metric "discount" can help you analyze your product performance.

Common Custom Definition Mistakes to Avoid

While custom definitions can provide valuable insights for eCommerce businesses, there are some common mistakes that businesses should avoid when setting them up in Google Analytics 4. Here are a few common mistakes to watch out for:

1. Inconsistent Naming Conventions:

It's essential to use consistent naming conventions when setting up custom definitions to ensure that data is accurately reported. Inconsistent naming conventions can lead to duplicate or missing data, making it difficult to analyze and act on the data.

Tip: Develop a naming convention for custom definitions and ensure that everyone on the team follows it consistently. This can include using a specific format or structure for naming conventions, such as using lowercase letters, underscores and numbers to separate words.

2. Setting Up Too Many Custom Definitions:

Setting up too many custom definitions can lead to data overload and make analysis challenging. It's essential to focus on the most critical KPIs that align with your eCommerce goals.

Tip: Prioritize the most critical KPIs that align with your eCommerce goals and set up custom definitions accordingly. Review your custom definitions periodically and remove any that are no longer necessary.

3. Not Testing Custom Definitions:

Failing to test custom definitions can result in missing or inaccurate data, leading to incorrect conclusions and poor decision-making. Do not forget to register your custom definitions in GA4 UI. Otherwise, you will not be able to use them in your reports.

Tip: Test your custom definitions thoroughly before putting them into production. Use the Preview mode of the GTM and/or DebugView section in Google Analytics 4 to confirm that your custom definitions are working as intended and are sent to GA4.

4. Not Mapping Custom Definitions to Business Objectives:

Custom definitions should align with specific business objectives and KPIs. Failure to align custom definitions with business objectives can result in irrelevant or misleading data.

Tip: Before creating custom definitions, map them to specific business objectives and KPIs. This ensures that the data you collect is relevant and actionable.

Limitations of Custom Definitions in GA4

While custom definitions in GA4 offer a great deal of flexibility and customization, there are some limitations to keep in mind.

One limitation is that custom definitions are limited to the scope of the event they are attached to. For example, if you create a custom definition to track a specific button click, that definition will only apply to events that include that button click. This means that if you want to track that metric across multiple events, you will need to create a separate custom definition for each event.


In conclusion, custom definitions are a powerful tool for eCommerce businesses using Google Analytics 4. There is no such thing as too much data, so why not use it?

If you want to take your Google Analytics 4 a boost, or identify the problems you are having with it, check out our comprehensive guide.

Share via:
Article by Dmitry
Wonderful creature

Senior Analytics and GTM expert.

Portugal Office
Portugal Office
Av. Faial 371, Estoril, Lisbon
+351 922 210 245
Ukraine Office
Ukraine Office
Yamska 35/33, Kyiv
+38 095 863 8573
Norway Office
Norway Office
Jacob Aalls Gate 14b, 0368 Oslo
+479 228 0348
USA Office
USA Office
1584 W Crystal Rock Ct Unit 1B, Round Lake Beach, ILLINOIS, 60073
+164 675 718 77