AnalyticaHouse
Deleted User

Analytica House

Sep 4, 2022
5 min read

GA4 Custom Definitions and Usage Areas

GA4 Custom Definitions and Usage Areas

The latest version of Analytics, GA4, allows you to understand the full customer lifecycle across both your website and mobile apps. 

While GA4 still shares many features with Universal Analytics, it also introduces some intriguing changes. The most notable of these is custom definitions. Of course, we’re not seeing the concept of dimensions and metrics for the first time in GA4. If you’ve been using Analytics for a while, you’re probably already familiar with custom dimensions.

When you send a hit to Google Analytics, certain data is collected automatically. This includes user identifiers (such as user IDs), device information, and also tracks which content the user interacted with and how they behaved on your website or mobile apps.

Benefits of Using Dimensions in GA4

However, there may be other data you want to collect that is specific to your website or mobile app. That’s where dimensions come into play. Simply put, a dimension is a parameter or feature of your data. It can describe a property of a product, event, user, page, etc. Dimensions help us better define and understand the what, where, and when of our data.
For example:

When a transaction occurs on a website, some possible dimensions are:

  • Transaction ID
  • Coupon Code
  • Last Traffic Source

When a user logs in to a website and we send a login event to Google Analytics, the dimensions of that event could include:

  • Login Method
  • User ID

When a product is purchased, possible dimensions are:

  • Product Name
  • Product Category
  • Product Variant
  • Product Size

When a logged-in user views their account page, dimensions might include:

  • User ID
  • Registered Country

GA4 Custom Definitions and Use Cases

Scopes in GA4

Within a GA4 property, you’ll notice you can also configure metrics. Dimensions and metrics are very similar, but one key difference is that dimensions can have an event scope or a user scope, whereas metrics are always event-scoped. The variety of scopes we were familiar with in Universal Analytics has been simplified, with a primary focus on the event scope. Let’s review the available scopes:

Event

Applies only to the specific event/hit where the dimension is sent. For example, you might send an event “trial_started” to Universal Analytics along with an extra parameter “pricing_plan”. That dimension will only apply to the “trial_started” event.

User

Applies to all events for a user from the moment the user property is set (as long as the GA cookie remains valid). In GA4, this is called a User Property, similar to user-scoped dimensions in Universal Analytics, but it only affects events going forward—it does not retroactively apply to past events within the same session.

Product

Only valid for a specific product (tracked via Enhanced Ecommerce). Even if you send multiple products in the same transaction, each product can have its own product-scoped dimensions (e.g., “product_color”, “product_size”).

Note: Session and hit scopes are not directly supported in GA4 yet, but Google has indicated they plan to add session scope in the future. If you need to apply a dimension to all events in a session, you must include that dimension with every event (via gtag.js or GTM).

Using Custom Definitions

If you want to use a parameter in GA4’s reports, you must register it as a Custom Definition. Otherwise, it won’t appear in the interface. You should do this at the same time you start sending the parameter, because custom definitions are not retroactive. Any data sent before you register the custom dimension or metric will not show up in your reports, though raw data (e.g., in BigQuery) will include it.

How to Add a Custom Dimension in GA4

  • In your existing GA4 property, go to Configure → Custom definitions.GA4 Custom Definitions and Use Cases
  • Click on Create custom dimension.GA4 Custom Definitions and Use Cases
  • Enter the name you want to see in reports into the Dimension name field.GA4 Custom Definitions and Use Cases
  • Select Event as the scope (since we’re defining an event parameter).
  • Optionally add a description in the Description field.GA4 Custom Definitions and Use Cases
  • Choose the parameter you’re sending from the Event parameter dropdown.GA4 Custom Definitions and Use Cases
  • Click Save. You can now use this dimension in your reports.GA4 Custom Definitions and Use Cases

How to Add a Custom Metric in GA4

  • In the Custom definitions area, switch to the Custom metrics tab and click Create custom metric.
  • Enter the name for the metric in the Metric name field.GA4 Custom Definitions and Use Cases
  • Provide a description in the Description field.GA4 Custom Definitions and Use Cases
  • Select the parameter from the Event parameter dropdown.GA4 Custom Definitions and Use Cases
  • Choose the appropriate Unit of measurement (e.g., Integer, Currency, Time).GA4 Custom Definitions and Use Cases
  • Save—your new custom metric is now available for reporting.GA4 Custom Definitions and Use Cases

Note: Free GA4 properties have limits on the number of custom definitions (e.g., up to 25 user properties, 50 custom dimensions). GA360 accounts have higher limits.

Summary and Tips

  • Register custom dimensions/metrics at the same time you begin sending the parameters—definitions are not retroactive.
  • Use tag manager or gtag.js to include parameters with every relevant event.
  • Choose the correct scope: Event for event parameters, User for user properties, and Product for ecommerce product data.
  • Leverage GA4’s custom definitions to enrich your data and unlock deeper analysis.

More resources