Sub topic 2
Importing variables: segments, dimensions and metrics
This chapter assumes you have Viewer access to a GA4 property, know the difference between a session and a user, and can open a Free-form exploration. You should also be comfortable reading a pivot table.
Importing variables
The Variables panel sits on the left of an exploration. It holds three kinds of fields:
- Segments: groups of users or sessions, such as "Purchasers".
- Dimensions: attributes that describe events, such as
deviceCategory. - Metrics: numbers you count or sum, such as
sessions.
Click the + icon beside Dimensions or Metrics, select the fields you need, and choose Import. The fields then appear in the panel, ready to drag into Tab Settings. If a field is greyed out or shows a warning, it conflicts with another field already in the table. Check its scope (event, session or user) before you remove other fields.
Tab Settings: where the report is assembled
Tab Settings, on the right of the canvas, holds the drop zones that define the table: Rows, Columns, Values, Filters and Segments. Drag a field from the Variables panel into a zone, and the table updates at once. The zone a field sits in decides its role. A dimension in Rows labels each line, and a metric in Values fills the cells.
Rows, columns and pivoting your data
A dimension in Columns splits the table across the top. Pivoting means moving a dimension from Rows to Columns, or the reverse, to read the same data another way. Use this request as the API equivalent of a table with channel group in rows and device category in columns:
{
"dateRanges": [{ "startDate": "28daysAgo", "endDate": "yesterday" }],
"dimensions": [
{ "name": "sessionDefaultChannelGroup" },
{ "name": "deviceCategory" }
],
"metrics": [{ "name": "sessions" }],
"limit": 25
}Values and cell types: plain text, bar and heat map
Each value has a cell type that controls how its numbers look:
- Plain text shows the number only.
- Bar shows a horizontal bar inside each cell, scaled to the largest value.
- Heat map colors each cell by its size.
Use bars to compare rows quickly. Use a heat map to find hot spots in a dense pivot table.
Exercise
You want sessions by channel group, split by device category. Which dimension goes in Rows, and which goes in Columns?
Show answer
Put sessionDefaultChannelGroup in Rows and deviceCategory in Columns, with sessions in Values.