Featured

What Are Custom Definitions in Google Analytics 4 (GA4)?

Many events in Google Analytics 4 (GA4) have fixed parameters that can be filled in automatically when they are called.

 

In the file_download event, for example, predefined parameters might include the name and extension of the file that is downloaded. If these parameters are not sufficient for your use cases, you can use your own parameters in Google tags and analyze them using a custom definition.

 

What Are Dimensions and Metrics in GA4?

These custom definitions are divided into custom dimensions and metrics. Differently named entries are collected in dimensions; some dimensions already included in GA4 are, for example, event names, pages, browsers, and countries. Metrics include values such as the number of users, clicks, or revenues. GA4 can use metrics to perform calculations, for instance, form a sum, calculate an average, or carry out greater-than and less-than comparisons.

 

With custom dimensions and metrics, you can add your own parameters to the predefined Google Analytics dataset. You can add these additional dimensions or metrics to the various reports or create your own reports with this data.

 

Sending Parameters to GA4

To send custom parameters to GA4, you must pass them in the tracking code. All you need to do is insert the parameters using their names and values. Let’s return to our example of custom events, shown in this listing.

 

gtag('event', 'ga4book', {

   'chapter': '2',

   'page': '43'

});

 

The event name in this case is ga4book, and the parameters are chapter with the value 2 and page with the value 43. Using this call, you first send these parameters to GA4, which accepts and checks them.

 

You can see the incoming values immediately in the Realtime report, as shown in the figure below. But only if you have created a custom dimension for chapter and page will the entered value be saved. You can use this self-defined dimension like other dimensions in reports, including in your own reports.

 

Incoming Values in the Realtime View of an Event

 

How Does This Differ from Custom Definitions in UA?

Unlike in UA, there is no longer an index number for a dimension or a metric in GA4. You’ll simply use the parameter name in the code and in the report configuration.

 

Creating Custom Definitions

To create custom definitions, go to the Manage section in the GA4 property and then click on the Custom definitions item to create your own dimension or metric. You should assign a meaningful name and description to explain the contents, as shown in the below figure. The Dimension name field appears later in the GA4 reports for selection.

 

Defining a Custom Dimension

 

An important specification is the Scope, which describes the scope of your dimension. GA4 has different variants in how it saves parameters and links them to other data. If the Scope is set to Event, the parameters and values are only saved for the event with which they were transferred.

 

In contrast, the alternative User setting links the values for the transmitted and all other events for this user. The value only needs to be transferred with an event, but you can still track what else this user has done later. A typical use case is the registration for a service or an offer: The user registers only once, and only this information is transmitted to GA4 and only once. With a filter on this dimension, you can track all other actions that have been logged for this user.

 

The Element level section is of particular interest for e-commerce: If you want to add data to your items, you’ll need a dimension at the item level.

 

Note that you cannot change the scope at a later date. Thus, before you create them you should think about whether and how you want to continue using the parameter data!

 

As the last step on the dimension setup screen, either select the Event parameter to populate the new dimension from the list or enter the parameter name. The input must be made in the same way as the parameter name is transferred in the gtag code, as shown in the previous figure.

 

Cardinality in GA4

Your GA4 property may have problems if your new dimension has a high cardinality, meaning that the parameter could receive a large number of different values. If more than 500 different entries are possible, GA4 might start to summarize entries (and thus no longer be able to break them down individually) to ensure efficient processing speed for reports.

 

Creating a custom metric is a similar process, with a few minor changes, such as the following:

  • Metrics can only have an Event as their scope.
  • You can also define an optional unit of measurement and choose from units for distances and times. Alternatively, you can define the metric as a currency field and specify whether the value is revenue data or cost data.

Limits of Dimensions and Metrics

For each property, you can define 50 custom dimensions and 50 metrics with the Event scope as well as 25 dimensions at user level. You can view your current consumption in the overview via the Quota information button. In this way, you can avoid having to count dimensions at the event or user level for a larger list, as shown in this figure.

 

Quota Information: Number of Dimensions and Metrics Created for Your Property

 

If you need additional definitions in a property but no more space is available, you can archive a dimension or metric that is no longer used. For this task, open the menu at the end of an item in definitions overview and select Archive, as shown below.

 

Archiving Dimensions and Metrics

 

Archiving frees up space for a new definition but can affect reports, segments, and audiences since they can no longer use an archived dimension as an element in a report or as a criterion for a user group. The archived element disappears from the definition list.

 

Editor’s note: This post has been adapted from a section of the book Google Analytics 4: The Practical Guide by Markus Vollmert. Markus is the founder and managing director of the Cologne-based digital marketing agency luna-park.

 

This post was originally published 7/2025.

Recommendation

Google Analytics 4
Google Analytics 4

Frustrated by the complexities of Google Analytics 4? Let us show you the way! Whether this is your first foray into GA4 or you need a detailed guide to supplement your existing training, you’ll get step-by-step instructions for your essential tasks. Learn to set up GA4, from creating an account to using custom definitions and defining conversions. See how to evaluate website users, manage campaigns, capture and evaluate online shopping information, and work with app data. With details on customizing reports, using BigQuery, troubleshooting errors, and administration, this really is your one-stop shop for GA4!

Learn More
Rheinwerk Computing
by Rheinwerk Computing

Rheinwerk Computing is an imprint of Rheinwerk Publishing and publishes books by leading experts in the fields of programming, administration, security, analytics, and more.

Comments