Sub topic 11
Custom Dimensions and Metrics: Making Parameters Reportable
Assume you understand GA4 events and event parameters, and can read basic JavaScript. This chapter explains how to make custom parameters usable in GA4 reports after you collect them.
Collection and reporting are separate steps
An event can contain parameters as soon as your tracking code sends it. GA4 can receive and store those values without any registration. However, standard reports and comparisons usually cannot use a custom parameter until you create a matching custom definition.
For example, this event sends two custom parameters:
gtag('event', 'tutorial_step_completed', {
step_number: 3,
tutorial_name: 'ga4_data_model'
});The event name is tutorial_step_completed. The parameters are step_number and tutorial_name. Sending the event collects the data. Registering custom definitions makes the parameter values available as fields in reports and explorations.
Choose the correct custom definition
Use a custom dimension for descriptive values that you want to group or filter by. Examples include tutorial_name, membership_level, or button_location.
Use a custom metric for numeric values that you want to calculate, compare, or aggregate. Examples include step_number, score, or items_saved.
A user property can also become a user-scoped custom dimension. Use this scope when the value describes a person over time, such as a customer's plan type. Use an event-scoped dimension when the value describes one interaction.
| Data you send | Custom definition | Typical question |
|---|---|---|
| `tutorial_name: "ga4_data_model"` | Event-scoped custom dimension | Which tutorial produced the most completions? |
| `score: 85` | Event-scoped custom metric | What was the average score? |
| `plan_type: "premium"` | User-scoped custom dimension | How do premium users behave? |
Register a parameter in GA4
In the GA4 interface, open Admin and find Custom definitions. Choose Create custom dimension or Create custom metric. Enter the exact parameter name that your implementation sends, select its scope, and provide a clear display name and description.
For an event parameter:
- Choose event scope for descriptive text.
- Choose metric type for numeric values.
- Enter the parameter key exactly, including capitalization.
- Save the definition.
- Wait for new data to appear in reports.
Registration does not normally rewrite older reports or fill the definition with historical values. Plan custom definitions before launching important tracking. Also check your property's current limits before creating many definitions.
Scope and type errors
Scope determines which rows can use a value. An event-scoped dimension belongs to individual events. A user-scoped dimension describes the user and may be applied across that user's activity.
A custom metric must receive numeric values. Sending "85 points" instead of 85 can prevent useful numeric aggregation. Conversely, registering a text value as a metric loses the ability to group meaningfully by its content.
Parameter names are case-sensitive in practice. tutorial_name, Tutorial_Name, and tutorialName should be treated as different keys. Use one naming convention and keep the implementation and registration identical.
Check the result
Use DebugView or another testing method to confirm that the event and parameter arrive. Then check the custom definition and wait for processed data. If values remain missing, verify the event name, parameter key, scope, value type, and reporting date range.
Avoid registering every temporary debugging value. High-cardinality dimensions, such as unique IDs, can make reports harder to read and may place values into an (other) row.
Exercise
You send plan_type: "premium" as a user property and score: 92 with an event. Which definitions should you create?
Show answer
Create a user-scoped custom dimension for plan_type and an event-scoped custom metric for score.