Custom Dimensions and Metrics in Enhanced Ecommerce

Google Analytics enhanced ecommerce enables the measurement of user interactions with products on ecommerce websites across the user’s shopping experience. It measures product page views, adding and removing products from shopping carts, initiated, abandoned, and completed transactions. Enhanced ecommerce comes with a group of predefined dimensions & metrics that represent info about the products sent to GA (e.g. product name, id, brand, price). If you want to pass extra info to GA about your products that don’t match with the enhanced ecommerce default elements, you have to do it in the form of custom dimensions and metrics.

Custom dimensions and metrics are powerful ways to collect and analyze data that Google Analytics don’t track automatically.  It allows you to combine data from your CRM system with  Analytics data, so you can have more insights and create advanced segments of your users.

There are multiple scopes of custom dimensions and metrics, but in this post, we will be covering only the product-scoped custom dimensions and metrics, which in other words, the enhanced ecommerce custom dimension and metrics.

Custom Dimensions

To pass product-scoped custom dimension to the ecommerce object of your enhanced ecommerce data layers. You have to  use the following notation to add it to the product:

dimensionn

n is the dimension index, each custom dimension has an associated index. There is a maximum of 20 custom dimensions (e.g. dimension1, dimension15).

Example

let’s say you own a fashion ecommerce website and you want to pass the clothes sizes to Google Analytics, you can add a custom dimension to your products array in the ecommerce object as below:

ecommerce': {
    'detail': {
      'actionField': {'list': 'Apparel Gallery'},
'products': [{
        'name': 'T-Shirt',
        'id': '12345',
        'price': '15.25',
        'brand': 'mad',
        'category': 'Apparel',
        'dimension1': 'large'
]
}
}

Finally, you need to configure the custom dimension in your Google Analytics property, ensure that the scope of your dimension is set to “product”.

product scoped custom dimension

Also, make sure that the custom dimension index matches the index you added to your code (dimension1).

google analytics custom dimension

Custom Metrics

Similar to custom dimensions, to pass product-scoped custom metrics to Google Analytics, we use the following notation :

metricn

n is the metric index, each custom metrics has an associated index. There is a maximum of 20 custom metrics (e.g. metric1, metric15).

Example

Let’s take the same example of the fashion store in custom dimensions. This time you want to pass the profit margin of every product on your website to calculate the actual profit you make. You can add a custom metric to your products array in the ecommerce object as below:

 

ecommerce': {
    'detail': {
      'actionField': {'list': 'Apparel Gallery'},
'products': [{
        'name': 'T-Shirt',
        'id': '12345',
        'price': '15.25',
        'brand': 'mad',
        'category': 'Apparel',
        'metric1': '0.15'
]
}
}

 

Then you need to configure the custom metrics on your Google Analytics property, make sure that the scope is product and the index matches the index in your array. In this specific example, the type is currency, but you  also can add integer numbers depending on your objectives.

product scoped custom metric

Finally, you can utilize this custom metric that you passed to GA and generate calculated metrics out of it. In our example, we can calculate the products profit by multiplying the margin (custom metric) to the product revenue as seen below:

calculated metric product profitIf you want more examples of custom dimensions, you can read our post about exposing the client and user id in Google Analytics: Expose Client & User ID in Google Analytics.

mm
Ahmed launched his first digital campaign in 2013 through participating in Google Online Marketing Challenge. He competed with over 12,000 students from 80 countries to win the first place in Africa & MENA region and one of the best five campaigns in the world. Today, he works as an Associate Digital Director at Keyade Middle East.

Leave a Reply

Your email address will not be published. Required fields are marked *