Environment variables

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

{
  app: {
    id: string;
  };
  browser: {
    lang: string;
  };
  i18n: {
    lang: string;
    tld: string;
  };
  payload?: string;
}

Environment object

Contains game environment variables.

Parameter

Type

Description

app

object

Game data.

browser

object

Browser data.

i18n

object

Service internationalization.

payload

string

The value of the payload parameter from the game's address. Optional parameter. For example, in https://yandex.ru/games/app/123?payload=test you can return test as follows: ysdk.environment.payload.

app structure

Parameter

Type

Description

id

string

Game ID.

browser structure

Parameter

Type

Description

lang

string

Preferred browser language in ISO 639-1 format.

i18n structure

Parameter

Type

Description

lang

string

Yandex Games interface language in ISO 639-1 format. For example, "tr" means that the game is currently running under the Yandex Games Turkish interface. We recommend using this parameter to determine the user's language in the game.

tld

string

Top-level domain. For example, "com" means that the game is currently running under the Yandex Games international domain. When hosting the game on your domain, keep in mind that it must open correctly on any Yandex domain.


Note

Our support team can help publish finished games or WebApps on Yandex Games. If you have any questions about development or testing, ask them in the Discord channel.

If you are facing an issue or have a question regarding the use of Yandex Games SDK, please contact support:

Write to chat