Sub topic 12
Registering custom dimensions and metrics so parameters appear in reports
This chapter assumes you can already send events with gtag.js or Google Tag Manager and can see them in DebugView. It also assumes you know your way around the GA4 Admin area. You need the Editor role on the property to register definitions.
Why parameters do not appear in reports by default
GA4 stores every event parameter you send. Most of them still cannot be used in standard reports or Explorations. Only a small set of built-in parameters, such as page_location or currency, has a matching dimension or metric out of the box.
Suppose you send this event:
gtag('event', 'newsletter_signup_click', {
placement: 'footer',
plan_type: 'free'
});DebugView will show placement and plan_type on the event. If you then open a report and look for "placement" as a dimension, you will not find it. The parameter reached GA4, but nothing in reporting is bound to it yet.
A custom definition creates that binding. It tells GA4: "Take the parameter with this name and expose it as a dimension or metric with this display name."
Dimensions and metrics
A dimension is an attribute you group or filter by, such as placement. A metric is a number you add up or average, such as shipping_cost.
| Kind | Holds | Typical use | Example parameter |
|---|---|---|---|
| Custom dimension | Text (or a value treated as text) | Segment, filter, break down | `plan_type` = `free` |
| Custom metric | A number | Sum, average, min, max | `shipping_cost` = `4.99` |
Choose the kind by how you want to analyze the value. A parameter such as tutorial_id identifies something, so it is a dimension. A parameter such as seconds_on_step is a quantity, so it is a metric.
Scopes
Each definition has a scope, which says what the value attaches to.
| Scope | Attaches to | Source in your code | Available for |
|---|---|---|---|
| Event | One event | Event parameter | Dimensions and metrics |
| User | A user, across events | User property | Dimensions only |
| Item | One product in an `items` array | Item-level parameter | Dimensions (and metrics in some cases) |
This chapter focuses on event scope, because that is how event parameters become reportable. The scope you pick must match where you send the value. If you send plan_type as an event parameter but register it as a user-scoped dimension, GA4 looks for a user property named plan_type and finds nothing.
Registering an event-scoped custom dimension
- Open Admin and select the correct property.
- Under Data display, choose Custom definitions.
- On the Custom dimensions tab, select Create custom dimension.
- Enter a Dimension name. This is the label people see in reports, for example
Signup placement. - Set Scope to Event.
- In Event parameter, choose the parameter from the list or type its exact name, for example
placement. - Add a description if you like, then select Save.
The parameter name must match what you send, character for character. GA4 treats placement and Placement as different parameters. The dropdown only lists parameters GA4 has already received, so send a test event first if yours is missing. You can also type the name by hand.
Registering an event-scoped custom metric
The steps are the same, on the Custom metrics tab. You also choose a Unit of measurement. The options are Standard (a plain number), Currency, Feet, Meters, Kilometers, Miles, Milliseconds, Seconds, Minutes, Hours, and Distance units.
Here is an event that sends a numeric parameter:
gtag('event', 'checkout_step_complete', {
step_name: 'shipping',
seconds_on_step: 42
});To report on seconds_on_step, create a custom metric with the name Seconds on step, scope Event, event parameter seconds_on_step, and unit Seconds. Reports can then show the total or the average per event.
The value must be numeric. Send 42, not "42 seconds". A string with text in it will not be counted.
What happens after you save
Registration is not retroactive. Three consequences follow.
- Data starts filling the new dimension or metric only from the moment you save it. Events collected earlier do not populate it, even though the raw parameter was sent.
- It can take up to about 24 hours before the field is available in standard reports. It often appears sooner in Explorations and in the Realtime report.
- Deleting a definition archives it. It does not erase data, but you lose the ability to report on it, and it still counts against your quota.
Because of the first point, register definitions before or at the same time as you launch an event, not weeks later. Treat registration as part of the release checklist.
Quotas
Each standard property has a limited number of custom definitions. Always check the current limits in Google's documentation, since they change. At the time of writing, a standard property allows these amounts:
| Definition | Standard property limit |
|---|---|
| Event-scoped custom dimensions | 50 |
| User-scoped custom dimensions | 25 |
| Event-scoped custom metrics | 50 |
| Item-scoped custom dimensions | 10 |
GA4 360 properties have higher limits. Because the limits are small, register only parameters you will actually analyze. Do not register every parameter "just in case".
Cardinality and high-cardinality values
Cardinality is the number of distinct values a dimension can take. A dimension such as plan_type has a handful of values. A dimension that stores a session ID or timestamp has millions.
High-cardinality dimensions cause trouble. When a report has too many unique values, GA4 groups the overflow into an (other) row, and some reports become less useful. Avoid registering parameters that hold unique identifiers or free text unless you have a clear reason.
Never send personal data
Custom dimensions are not a place for email addresses, names, phone numbers, or other personally identifiable information. Google's policies prohibit sending it, and a registered dimension makes the problem easier to see in reports. Use an internal, non-identifying ID if you need to join data later.
Common mistakes
- Name mismatch. The registered parameter is
planType, but the code sendsplan_type. The dimension stays empty. Compare the two strings exactly. - Wrong scope. An event parameter registered as user scope, or the reverse.
- Expecting history. Looking for last month's values after registering today.
- Number sent as text. A metric parameter sent as
"42"with extra characters, or formatted with currency symbols or thousands separators. - Registering too early or too much. Using up quota on parameters nobody reports on.
- Changing the parameter name in code. Renaming a parameter later breaks the link. You must register a new definition for the new name, and the old one keeps only the old data.
A short verification routine
- Confirm the parameter and its value appear in DebugView.
- Register the definition.
- Send fresh events, since old ones will not fill it.
- Check the Realtime report or an Exploration for the new field.
- Wait for standard reports to catch up, up to about a day.
In an Exploration, add your custom dimension under Dimensions in the Variables panel. Drag it to Rows, and add Event count as a value filtered to your event. You should then see one row per value of the parameter.
Exercise
Your site sends gtag('event', 'video_progress', { video_title: 'Intro', percent_watched: 50 });. You want a report that lists the average percent_watched for each video_title. Which custom definitions do you register, with what scope, and what happens to events sent yesterday?
Show answer
Register two event-scoped definitions. First, a custom dimension (for example "Video title") with the event parameter video_title. Second, a custom metric (for example "Percent watched") with the event parameter percent_watched, with the Standard unit. Both must use Event scope because the values are sent as event parameters. Yesterday's events will not fill the new fields, because registration is not retroactive. Only events received after you save will populate them, and standard reports can take up to about 24 hours to show them.
Exercise
A custom dimension called "Signup placement" was registered for the parameter Placement, but your code sends placement. The report shows only "(not set)". Why, and how do you fix it?
Show answer
Parameter names are case-sensitive, so Placement and placement are different parameters and the dimension never receives data. Create a new event-scoped custom dimension for placement (archive the wrong one if you need the quota back). The new dimension fills only with events sent after you save it.