Environment variables

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

 1{
 2  app: {
 3    id: string;
 4  };
 5  i18n: {
 6    lang: string;
 7  };
 8  payload?: string;
 9  referrer?: {
10    type: "promo";
11    promoId: string;
12    intent?: string;
13    inappId?: string;
14  }
15}

environment object

Contains game environment variables.

Parameter

Type

Description

app

object

Game 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.

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 automatically detect the user's language in the game (item 2.14).

Example

1const ysdk = (await YaGames.init());
2const lang = ysdk.environment.i18n.lang; // 'en', 'ru', ...

referrer structure

Use ysdk.environment.referrer to handle player transitions from promotional banners in the catalog. Benefits:

  • For the player: after clicking a promotion, the player lands directly on the relevant screen — seeing exactly the offer they clicked on. This improves conversion and reduces early drop-off.
  • For you: you can track the effectiveness of each promotion — how many players clicked through and how many made a purchase. To collect statistics, additionally enable Yandex Metrica.

Setup

  1. In the Developer Console, add a promotion. The platform will automatically generate a deeplink for promotional banners in the catalog.

    Example link with promotion parameters:

    https://yandex.ru/games/app/{id}?lang=ru&referrer=promo&promo_id={PROMO_ID}&promo_intent={INTENT}&inapp_id={INAPP_ID}
    

    Parameter

    Description

    Required

    Source

    referrer

    Tells the platform that the transition is from a promotion.

    Always promo

    promo_id

    Promotion ID for routing and analytics.

    ID

    promo_intent

    An arbitrary hint for in-game routing and analytics.

    Intent

    inapp_id

    ID of the in-app purchase associated with the promotion in the game.

    In-app ID

  2. Add transition handling to the game: the SDK passes deeplink parameters to the ysdk.environment.referrer object — use them to show the player the relevant screen.

    Parameter

    Type

    Description

    Source

    type

    "promo"

    Shows the transition source. Track type: "promo" to collect analytics on promotions.

    referrer=promo

    promoId

    string

    Promotion ID from the Promos tab in the Console. Use it to configure an action for a specific promotion and collect analytics on it.

    promo_id

    intent

    string

    An arbitrary string, e.g. open_starter_pack. Use it to configure a default action after a promotion transition and collect analytics on it. Optional parameter.

    promo_intent

    inappId

    string

    In-app purchase ID from the Inaps tab in the Console. Use it to open the platform purchase dialog. Optional parameter (for discount promotions only).

    inapp_id

  3. Test the transitions: on the Promos tab, in the Check transition field, click In the published version or In the draft. If everything is configured correctly, you will see the promotion screen: an offer, a shop, or a specific in-app purchase.

Example

 1// 1. SDK initialization
 2const ysdk = await YaGames.init();
 3
 4// 2. Get the referrer
 5const { referrer } = ysdk.environment;
 6
 7// 3. Handle the promotion transition
 8if (referrer?.type === 'promo') {
 9    if (referrer.inappId) {
10        showPurchaseScreen(referrer.inappId);
11    } else if (referrer.intent) {
12        openScreen(referrer.intent);
13    }
14}

Common scenarios

Scenario

Target audience

Goal

Example

Product discount

Non-paying players

First payment

promo_id=SPRING_DISCOUNT
promo_intent=open_starter_pack
inapp_id=starter_pack_001

showPurchaseScreen()

VIP offer or shop opening

Paying players

Increase average order value

promo_id=VIP_PROMO
promo_intent=open_shop

openShop()

Seasonal sale

All active players

Retention

promo_id=SALE_SPRING_2026

→ basic flow, banner


Note

Our support team can help publish finished games 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

Game data.

Game ID.

Service internationalization.

The 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.

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.

Data about the transition from a promotion. Present if the game was opened via a deep link from a promotional banner. undefined otherwise.

Transition source. Always "promo".

Promotion ID from the Promos tab in the Console.

An arbitrary string, e.g. open_starter_pack. Optional parameter.

In-app purchase ID from the Inaps tab in the Console. Optional parameter (for discount promotions only).