Parametrization

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, the ym:s:datePeriod<group> dimension is parameterized by the group parameter.
  • To get the number of converted sessions, the ym:s:visits metric is parameterized as follows: ym:s:goal<goal_id>visits.

The existing parameters are:

Parameter

Name

Description

Default value

goal_id

Goal

ID of the goal.

group

Dimension

Grouping by time period for certain dimensions. Acceptable values: day, week, month, quarter, year.

week

attribution

Attribution model

Some dimensions let you set an attribution model. Possible values:

  • first: The first source.
  • last: The last source.
  • lastsign: The last significant source.
  • last_yandex_direct_click: The last click from Yandex.Direct.

The values that define cross-device attribution are also available:

  • cross_device_first: The first source, including sessions from all the user's devices.
  • cross_device_last: The last source, including sessions from all the user's devices.
  • cross_device_last_significant: The last significant source, including sessions from all the user's devices.
  • cross_device_last_yandex_direct_click: The last click from Yandex.Direct, including sessions from all the user's devices.
  • automatic: Automatic attribution. For more information, see the Help section.

lastsign

currency

Currency

Some dimensions allow setting the currency.

Acceptable values: RUB, USD, EUR, YND. See also ISO-4217.

Depends on the tag settings

experiment_ab

Experiment ID in Yandex.Direct or Yandex.Audience

In Yandex.Audience, you can create experiments, and in Yandex.Direct, you can set up campaigns based on your experiments. In Yandex.Metrica, you can track your experiment using the Yandex.Direct, experiments report.

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.