Transmitting session parameters
The majority of session data is collected automatically by your Yandex.Metrica tag. However, you'll likely find that it would benefit you to supplement this data with your own data. For example, you may be interested in statistics on what specific items were purchased or what actions users who were logged in performed.
Yandex.Metrica lets you connect a custom data set to the corresponding session. These sets are called session parameters. This data can be shown in reports, or used in conditions for dimensions and segmentation.
During tag initialization, session parameters are specified in the params parameter.
Up to 1000 parameters can be transmitted in a single session. When the hierarchical data structure is transmitted, the Yandex.Metrica reports will display up to 10 nesting levels. If, within a single session, one parameter was transmitted with different values, then Yandex.Metrica will display all values.
Processing transmitted data
The field name and nesting level are interpreted as the parameter name and level, respectively. The field value is processed as follows, depending on its type:
- object — A tree branch is created for each object key, and the algorithm is called recursively for each value.
- string — Counts the number of times each different value of the string occurs.
- number — Calculates the total and average value of all numbers.
- array — Creates a [Parameters] tree branch, calculates the number of times the value is an array, and invokes the algorithm recursively for each item in the array.
- true, false or null — Calculates the number of times each value occurs.
Parameters are transmitted to Yandex.Metrica as dimensions. The numbers that are calculated by processing the data are the metrics. To view statistics on transmitted session parameters, use the Session parameters report. You can also use parameters as conditions for creating segments in other Yandex.Metrica reports.