Localization and interpretation of dimension values
The values of some dimensions may be given as an identifier, or as a text key. Text keys are localized, meaning they are translated to the language that is currently selected in the API.
To find out which dimensions support ID interpretation, see the Description column under Dimensions. For these dimensions, the API returns the id key, which is the ID of this dimension's value, and the name key, which is the value's description in the request language.
When filtering and using drill down, use IDs for these dimensions.
You can control the request language using the lang parameter, which is accepted by all API methods, or by selecting the top-level domain to access the API.
If the lang parameter is omitted, the en value and the international geobase are used by default. Use lang=ru in the request if:
- The filter uses Cyrillic characters
- Your users are in the
rudomain (to ensure proper generation of the audience geography report).
Example
Let's consider the request:
https://api-metrika.yandex.net/stat/v1/data?id=44147844&dimensions=ym:s:<attribution>TrafficSource&metrics=ym:s:visits
...
{
"dimensions": [
{
"id": "organic",
"name": "Traffic from search engines"
}
],
"metrics": [
...
]
}
...
where
-
idis the ID of theym:s:<attribution>TrafficSourcevalue. -
nameis the description.
To filter the report by search engines, you can use this syntax: filters=ym:s:<attribution>TrafficSource=='organic'.
Traffic source values
|
Id |
Traffic source |
|
|
Internal traffic |
|
|
Direct traffic |
|
|
Link traffic |
|
|
Search engine traffic |
|
|
Ad traffic |
|
|
Cached page traffic |
|
|
Undefined |
|
|
External links traffic |
|
|
Mailing traffic |
|
|
Traffic from social networks |
|
|
Recommendation system traffic |
|
|
Messenger traffic |
|
|
QR code traffic |