Environment variables

You can get information about the environment the game is run in. 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.

Parameter

Type

Description

app

table

Game data.

browser

table

Browser data.

i18n

table

Service internationalization.

payload

string|nil

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

Priority 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. Use 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 on the international domain of Yandex Games. When hosting the game on your own domain, ensure that it properly opens on any yandex domain.


Repository