Sub topic 10
Using custom dimensions and metrics in reports and Explorations
This chapter assumes you have already sent a parameter or user property, checked it in DebugView, and registered it in Admin as a custom dimension or custom metric. It covers what happens next: where the definitions show up, how to add them to reports, how to use them in Explorations and audiences, and why the numbers sometimes look wrong.
Where registered definitions appear
Registration makes a definition available to every reporting surface in the property. It does not add it to any existing report. Standard reports keep their default columns until you change them.
The table summarizes how each surface treats the definitions.
| Surface | Custom dimensions | Custom metrics |
|---|---|---|
| Standard reports | Secondary dimension, or added to a customized report | Added as a column in a customized report |
| Explorations | Imported in the Variables panel | Imported in the Variables panel |
| Audiences | Usable as conditions | Usable as conditions on the metric value |
| Data API | `customEvent:`, `customUser:`, `customItem:` prefixes | `customEvent:` prefix |
Standard reports
The quickest check is a secondary dimension. Open a report such as Engagement > Events. Click the + next to the primary dimension. Search for your custom dimension under the Custom category and select it. The table now splits each row by that dimension's values.
A secondary dimension is temporary. To keep a custom dimension in a report, customize the report:
- Open the report and click the pencil icon (Customize report).
- Open Report data, then Dimensions, and choose Add dimension.
- Pick your custom dimension. Optionally make it the default primary dimension.
- Open Metrics and choose Add metric to add a custom metric as a column.
- Select Save, then choose Save changes to current report or Save as new report.
Editing a report needs the Editor role or higher. A report saved as new is not visible in the left navigation until you add it to a collection in Reports > Library and publish that collection.
Explorations
Explorations are usually the best place to work with custom definitions. They are flexible, and they show you what is compatible.
- Create a Free form exploration.
- In the Variables panel, click + next to Dimensions. Search for the custom dimension and tick it. Click Import.
- Do the same next to Metrics for any custom metric.
- Drag the dimension into Rows and the metric or Event count into Values.
Imported variables stay in the Variables panel for that exploration, so you only import them once.
Compatibility and greyed-out items
Explorations grey out dimensions and metrics that cannot be combined. The scope of the definition drives most of these rules.
- Event-scoped dimensions work with event-based metrics such as Event count, Total users and your custom metrics.
- User-scoped dimensions work with event and user metrics.
- Item-scoped dimensions only work with item metrics such as Items viewed, Items purchased and Item revenue. They do not combine with Event count.
If you drag an item-scoped dimension into a table next to Event count, the exploration rejects it or shows an incompatibility warning. Use an item metric instead.
Reading custom metric values
A custom metric is a sum of the parameter values across the events in the date range. If 100 video_complete events each carry video_length_seconds: 184, the metric shows 18,400 seconds. The display follows the unit you chose at registration, so a metric registered as Seconds may show a formatted time.
For a per-event figure, divide the sum by Event count. You can do this in a table by hand, in a calculated metric, or in a downstream tool such as Looker Studio. GA4 does not average a custom metric for you.
Understanding "(not set)"
The value (not set) appears constantly with custom dimensions. It does not always mean a bug. Common causes:
- Event-scoped dimension, different events. The row's events did not carry the parameter. For example,
plan_tieris only sent onselect_plan, sopage_viewrows show(not set). Filter or add an event name dimension to separate them. - User-scoped dimension, earlier events. User properties apply to events after they are set. Events earlier in the session, before the
gtag('set', 'user_properties', ...)call ran, have no value. - Data before registration. GA4 does not backfill. Anything collected before you registered the definition stays unavailable for that dimension. You will see
(not set)or no rows for earlier dates. - Parameter name mismatch. The registered parameter name must match exactly, including case.
Plan_Tierandplan_tierare different parameters.
Compare against a known-good set of events in DebugView or the Realtime report when you need to find out which cause applies.
Filtering, segments and comparisons
Once imported, a custom dimension behaves like any built-in one.
- Use it as a filter in an exploration tab to restrict rows, for example
billing_cycleexactly matchesannual. - Use it in a segment to build a user or session subset. A user-scoped dimension such as
customer_typesuits a user segment. - Use it in report comparisons, which compare groups of rows in a standard report side by side.
Event-scoped dimensions in segments are evaluated per event. To define a segment as "users who ever selected the annual plan", use an event condition on the parameter value, not just the dimension row.
Audiences
The audience builder can use registered definitions. Add a condition and choose the dimension or metric. A user-scoped customer_type equals subscriber is the simplest audience. For an event-scoped value, you can use an event condition for select_plan and add the parameter plan_tier equals pro.
Two rules to keep in mind:
- Audience membership is evaluated going forward from creation. A new audience does not recompute users from before the audience existed, apart from the look-back GA4 applies to some conditions.
- A custom metric condition uses the metric's value, so check that it is registered with the unit you expect.
Querying with the Data API
The Data API uses the same registered definitions, with a prefix that matches the scope. This request counts events per plan_tier over the last 28 days. It also sums the basket_size custom metric, which must be registered first.
{
"dateRanges": [{ "startDate": "28daysAgo", "endDate": "today" }],
"dimensions": [{ "name": "customEvent:plan_tier" }],
"metrics": [
{ "name": "eventCount" },
{ "name": "customEvent:basket_size" }
]
}Use customUser: for user-scoped dimensions and customItem: for item-scoped ones. The API rejects names that were never registered, which makes a useful check that registration succeeded.
Common problems in reports
| Symptom | Likely cause | Fix |
|---|---|---|
| Dimension is missing from the picker | Not registered, or registered under a different scope | Check Admin > Custom definitions |
| New dimension shows no data | Processing delay, or no events sent since registration | Wait up to 24 to 48 hours, then check DebugView |
| Only `(not set)` for old dates | No retroactive data | Compare only from the registration date |
| Many rows grouped as `(other)` | High cardinality | Reduce distinct values at source, or use a smaller date range |
| Item dimension greyed out | Paired with a non-item metric | Switch to an item metric |
| Small numbers or hidden rows | Data thresholds apply | Remove demographic data or widen the range |
Exercises
Exercise
You registered an item-scoped custom dimension item_color and want to see how often each color is viewed. In an exploration, item_color is greyed out when you pair it with Event count. What should you do?
Show answer
Pair it with an item-scoped metric such as Items viewed. Item-scoped dimensions are only compatible with item metrics, not with event-scoped metrics like Event count.
Exercise
A custom metric video_length_seconds is registered with the unit Seconds. In an exploration over all events, you divide it by Event count and get a very low average video length. Why, and how do you fix it?
Show answer
Event count includes every event, but only video_complete events carry the parameter. Filter the exploration to the video_complete event name (or use that event's count) before dividing, so the denominator matches the events that contributed to the sum.
Exercise
You registered plan_tier on 12 November. A colleague asks for a chart of plan tier by week for October. What do you tell them?
Show answer
It is not possible. GA4 does not apply custom dimensions retroactively, so events collected before registration cannot be broken down by plan_tier. Data is available only from the registration date, and only for events that carried the parameter.