Skip to main content

Environment variables

You can get information about the environment in which the game is running. To do this, use the ysdk.environment object.

{
app: {
id: string
},
browser: {
lang: string
},
i18n: {
lang: string;
tld: string;
},
payload: string|nil;
}

Environment object

Contains game environment variables.

ParameterTypeDescription
apptableGame data.
browsertableBrowser data.
i18ntableInternationalization on the service.
payloadstring|nilThe value of the payload parameter from the game address. Optional parameter. For example, for the game https://yandex.com/games/app/123?payload=test the value test can be obtained as follows: ysdk.environment.payload.

App structure

ParameterTypeDescription
idstringGame identifier.

Browser structure

ParameterTypeDescription
langstringBrowser language in ISO 639-1 format.

I18n structure

ParameterTypeDescription
langstringYandex Games interface language in ISO 639-1 format. For example, "tr" means that the game is currently running in the Turkish Yandex Games interface. We recommend using this parameter to determine the user's language in the game.
tldstringTop-level domain. For example, "com" means that the game is currently running on the international Yandex Games domain. When placing a game on your domain, make sure that it opens correctly on any yandex domain.