The Reports API supports parametrization of dimensions and metrics.

Parametrization is a mechanism for setting parameters for certain dimensions and metrics.

The parameters are defined in angle brackets <>. For example:

  • To group sessions by time period, the ym:s:datePeriod<group> dimension is parameterized by the group (grouping) parameter.
  • To get the number of converted sessions, the ym:s:visits metric is parameterized as: ym:s:goal<goal_id>visits.

The existing parameters are:

Parameter Name Description Default value
goal_id Goal ID of the goal
group Grouping

Grouping by time period for certain dimensions.

Acceptable values: day, week, month, quarter, year.

attribution Traffic attribution

Some dimensions allow setting traffic attribution.

Possible values: first (the first source), last (the last source), lastsign (the last significant source).

currency Currency

Some dimensions allow setting the currency.

Acceptable values: RUB, USD, EUR, YND (Yandex units). See also ISO-4217

Depends on the counter settings

There are two ways to set a parameter in an expression:

  • Set the parameter directly in the expression (for example, ym:s:goal12345IsReached) — this lets you set different parameter values for different expressions.
  • Add the expression parameter to the request in its original form (for example, ...&dimensions=ym:s:goal<goal_id>IsReached&goal_id=12345&...) — this lets you set a single parameter for all expressions.

You can use both of these methods in a request simultaneously.

See the example of how parametrization of dimensions and metrics is used.