Remote Config

Add the getFlags method from the Yandex Games SDK to activate the Remote Config.

Call getFlags each time you start a new session to get the values of the saved flags (feature toggles).

let discount_percent = 10; // default discount
let banner_location = 'top'; // default banner location

YaGames.init()
    .then(ysdk => ysdk.getFlags())
    .then(flags => {
        discount_percent = Number(flags.discount_percent);
        // ...
        banner_location = flags.banner_location;
        // ...
    })
    .catch(e => {
        // process the error
    });

YaGames.init()
    .then(ysdk => ysdk.getFlags())
    .then(flags => {
        complexity = flags.complexity;
        // ...
    })
    .catch(e => {
        // process the error
    });


YaGames.init()
    .then(ysdk => ysdk.getFlags({ defaultFlags: { complexity: 'low' } }))
    .then(flags => {
        complexity = flags.complexity; // 'hard'
        // ...
    })
    .catch(e => {
        // process the error
    });

const flags3 = await ysdk.getFlags({
  defaultFlags: {},
  clientFeatures: []
});

const flags3 = await ysdk.getFlags(optional?);

const flags4 = await ysdk.getFlags({
  defaultFlags: { complexity: 'low' }
});

const flags5 = await ysdk.getFlags({
  defaultFlags: { complexity: 'low' },
  clientFeatures: [ { name: 'coreUser', value: '1' } ]
});


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