Dimensions and metrics

A dimension is an attribute of a session or hit that can be used for grouping data.

In API requests, dimensions are set in the dimensions parameter. If you need to list multiple dimensions, separate them with commas.

It is also possible to make a report without dimensions; in this case, the total result is calculated.

A metric is a numerical value that is based on an attribute of a hit or session.

In API requests, metrics are set in the metrics parameter. If you need to list multiple metrics, separate them with commas.

More about terminology

For a better understanding of the terms “dimension” and “metric”, consider the example of a Yandex.Metrica report on the operating system:

Operating system Page depth
Windows 4,2
IOS 3,1
Linux 1,6

Where

  • Operating system is an attribute of a session that is used for grouping report data (a dimension).
  • Page depth is a value calculated from numerical attributes of sessions (a metric) corresponding to the specified dimension.
Note.

If you are familiar with SQL, you can think of dimensions as columns used for grouping, and metrics as the results returned by aggregate functions.

For example, the report shown above can be imagined as a query to a hypothetical table of sessions:

SELECT operatingSystem, avg(depth) from visits GROUP BY operatingSystem

Why is the term “dimension” used?

In the example, a session has a single attribute — the operating system. If we add another attribute (for example, the OS version):

Operating system OS version Page depth
Windows 7 3,1
IOS 6 3,1
Windows XP 1,1

we can show sessions in two dimensions:

  • the OS on one axis (dimension),
  • and the OS version on the other axis.

In this way, each attribute adds another dimension.

You can create the desired report structure by specifying metrics and dimensions in the API request.