Sub topic 2
Dimensions and metrics: the building blocks
This chapter assumes you have read the previous chapter on GA4's event model, so you know that every interaction is an event with parameters. It also assumes you can read a pivot table. Every table you build in a Free-form exploration is made of two kinds of fields, dimensions and metrics. If you know which is which, most of the Variables panel and many of the errors you see will make sense.
The core distinction
A dimension is an attribute of your data. It describes something, and its values are usually text, such as mobile, Organic Search or /pricing. A metric is a quantity. It is a number that GA4 calculates from events, such as sessions, users or event count.
A dimension answers "which one?" and a metric answers "how many?". A table needs both. A column of metrics with no dimension gives you one grand total. A column of dimensions with no metric gives you labels with nothing to compare.
GA4 works like a grouped aggregation in SQL. The dimension is the GROUP BY column and the metric is the aggregate function. If you know SQL, SELECT device_category, COUNT(DISTINCT session_id) ... GROUP BY device_category is the same operation.
Common dimensions and metrics
The names below are the ones you will see in the Variables panel. The API name is the identifier you would use in a Data API request.
| Kind | UI name | API name | What it gives you |
|---|---|---|---|
| Dimension | Session default channel group | `sessionDefaultChannelGroup` | Marketing channel of the session, such as Direct or Organic Search |
| Dimension | Device category | `deviceCategory` | `desktop`, `mobile` or `tablet` |
| Dimension | Page path + query string | `pagePathPlusQueryString` | The URL path of a page view |
| Dimension | Event name | `eventName` | The name of the event, such as `page_view` |
| Metric | Sessions | `sessions` | Count of sessions |
| Metric | Engaged sessions | `engagedSessions` | Sessions that lasted over 10 seconds, had a conversion event, or had at least 2 page or screen views |
| Metric | Total users | `totalUsers` | Distinct users with any event |
| Metric | Event count | `eventCount` | Total number of events |
Active users and total users are different metrics. Active users counts only users with an engaged session or certain first-visit events. Total users counts every user who triggered any event. The two numbers will not match, so pick one and say which in your report.
Metric types
Metrics differ in the kind of number they return, and that affects how a cell is shown and how totals are calculated.
- Standard (count): whole numbers such as sessions and event count.
- Ratio: a percentage, such as engagement rate (engaged sessions divided by sessions) or bounce rate.
- Time: a duration in seconds, such as average engagement time per session.
- Currency: money, such as purchase revenue, shown in the property's currency.
Ratio and average metrics are computed from the underlying numbers for each cell. They are not averages of other cells. For example, a total engagement rate is total engaged sessions divided by total sessions. It is not the mean of the row percentages.
Why metric totals do not always add up
A new analyst often sums a column and gets a different number from the total row. This is expected for any metric that counts distinct things.
Suppose a user visits on a phone in the morning and on a laptop in the evening. In a table with Device category as rows, that user is counted once under mobile and once under desktop. The row values add up to 2 users, but the property has 1 user. GA4 de-duplicates in the total row, so the total can be smaller than the sum of the rows.
The same logic applies when you add more dimensions. Each extra dimension splits the rows further, so each cell holds fewer events, and the total stays the same.
How the pair behaves in a table
When you place a dimension in Rows and a metric in Values, GA4 does the following:
- It collects all events in the date range.
- It groups them by each distinct value of the dimension.
- It calculates the metric inside each group.
- It shows one row per group.
If you add a second dimension to Rows, grouping happens on every combination of values. With Session default channel group and Device category, you get one row for each pairing, such as Organic Search / mobile. If you place the second dimension in Columns instead, the same combinations appear as a grid. The numbers are identical, and only the layout differs. Tab Settings and pivoting are covered in later chapters.
If you place no dimension anywhere, you get one total per metric. If you place more than one metric in Values, each metric is calculated separately for every group.
Dimensions that return `(not set)`
A row labelled (not set) means GA4 has no value for that dimension on those events. The usual reasons are:
- The parameter was never sent on those events.
- The dimension applies at a different scope than the events you are counting. For example, a session-scoped dimension combined with an event that fired before a session started.
- A custom dimension was registered after the data arrived. Custom definitions are not applied to past data.
- Processing has not finished for recent data.
(not set) is a real value in the table, not an error. Check the row's share of the total before you conclude something is broken.
Custom dimensions and custom metrics
The built-in fields cover standard behavior. When you send your own event parameters, such as plan_type or video_title, GA4 stores them but does not make them available in reports until you register them.
- Open Admin and go to Custom definitions.
- Choose Create custom dimension or Create custom metric.
- Select the scope, enter a name, and pick the event parameter or user property it reads.
- Save. The field appears in the Variables panel's list.
Keep these points in mind:
- A custom dimension reads text. A custom metric reads a number, and you pick its unit, such as standard, currency or a time unit.
- Registration is not retroactive. Data collected before you saved the definition does not gain the field.
- Each property has quotas on custom definitions. A standard property allows 50 event-scoped custom dimensions, 25 user-scoped ones and 50 custom metrics. Check the current limits in the GA4 documentation, because they change.
- Do not register a parameter with a huge number of different values, such as a raw timestamp or a user ID. High-cardinality fields produce tables with many rows, and GA4 may group the overflow into an
(other)row. - Do not send personally identifiable information in parameters. It violates Google's terms.
GA4 also lets you define calculated metrics in Admin, such as revenue divided by sessions. Once defined, they show up in the metric list like any other.
Choosing fields for a question
Start with the question and work backwards to the fields.
| Question | Dimension | Metric |
|---|---|---|
| Which channels bring the most visits? | Session default channel group | Sessions |
| Which pages get the most views? | Page path + query string | Views |
| Do mobile users engage as much as desktop users? | Device category | Engagement rate |
| Which events fire most often? | Event name | Event count |
If you cannot name the dimension, you do not yet know what you are comparing. If you cannot name the metric, you do not know what you are measuring. State both before you open the exploration.
Compatibility is a preview of the next chapter
Not every dimension works with every metric. The Variables panel will let you import both, but a field that cannot work with the others in your table turns grey or shows a warning when you try to use it. This happens because dimensions and metrics have scopes (event, session, user or item), and GA4 can only combine fields whose scopes make sense together. The next chapter explains the rules and how to fix the common cases.
Exercise
A table has Device category in Rows and Total users in Values. It shows 600 users for desktop, 450 for mobile and 50 for tablet, and the total row shows 950. A colleague says the total should be 1,100. Who is right, and why?
Show answer
The total row is right. Total users is a distinct count. Some people used more than one device in the date range, so they appear in more than one row. Adding the rows (600 + 450 + 50 = 1,100) counts those people more than once. GA4 de-duplicates them in the total, so the real number of distinct users is 950.
Exercise
You send a new event parameter called plan_type on checkout events, but the dimension is missing from the Variables panel and last week's data shows no values for it. What do you need to do, and will last week's data be fixed?
Show answer
Register plan_type as a custom dimension in Admin under Custom definitions, with the correct scope (event scope for a per-event value). Once it is saved, new events will report it. Custom definitions are not retroactive, so last week's data will still show (not set).