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 thegroup
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 of the goal. |
|
|
Dimension |
Grouping by time period for certain dimensions.
Acceptable values: |
|
|
Attribution model |
Some dimensions let you set an attribution model. Possible values:
The values that define cross-device attribution are also available:
|
|
|
Currency |
Some dimensions allow setting the currency. Acceptable values: |
|
|
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.