> For the complete documentation index, see [llms.txt](https://wiki.playgama.com/playgama/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.playgama.com/playgama/bridge-sdk/api/remote-config.md).

# Remote Config

{% hint style="info" %}
You are reading the documentation for Bridge SDK **v2**. If you need the obsolete v1 documentation, see [Documentation (v1)](https://wiki.playgama.com/playgama/bridge-sdk-v1).
{% endhint %}

Read game settings (difficulty, drop rates, feature flags, A/B values) from the platform at runtime. This lets you change behavior without shipping a new build. Available on a subset of platforms.

Fetch once at startup before gameplay, and **always provide hardcoded defaults** for every key. The request can fail, or the platform can return only part of your config.

## Support

Check this before requesting remote values. If unsupported, use your local defaults.

{% tabs %}
{% tab title="Plain JS" %}

```javascript
bridge.remoteConfig.isSupported
```

{% endtab %}

{% tab title="Unity" %}

```csharp
Bridge.remoteConfig.isSupported
```

{% endtab %}

{% tab title="Construct 3" %}
Use the PlaygamaBridge **Is Remote Config Supported** condition. If unsupported, use your local defaults.
{% endtab %}

{% tab title="GDevelop" %}
Use the PlaygamaBridge **Is Remote Config Supported** condition. If unsupported, use your local defaults.
{% endtab %}

{% tab title="Godot" %}

```gdscript
Bridge.remote_config.is_supported
```

{% endtab %}

{% tab title="GameMaker" %}

```javascript
playgama_bridge_remote_config_is_supported()
```

{% endtab %}

{% tab title="Defold" %}

```lua
bridge.remote_config.is_supported()
```

{% endtab %}

{% tab title="Cocos Creator" %}

```javascript
bridge.remoteConfig.isSupported
```

{% endtab %}
{% endtabs %}

<details>

<summary>Platform support · 1 of 26 platforms</summary>

**Supports:** `yandex`

**Does not support:** `crazy_games`, `discord`, `dlightek`, `facebook`, `game_distribution`, `gamepush`, `gamesnacks`, `huawei`, `jio_games`, `lagged`, `microsoft_store`, `msn`, `ok`, `playdeck`, `playgama`, `poki`, `portal`, `reddit`, `samsung`, `telegram`, `tiktok`, `vk`, `xiaomi`, `y8`, `youtube`

</details>

## Set Context

Set dynamic game/player parameters used by the platform for config segmentation (for example, Yandex `clientFeatures`). Parameters accumulate across calls and are forwarded to the platform SDK on every `get()`.

Call it **before** `get()` — for example, right after you know the player's segment.

{% tabs %}
{% tab title="Plain JS" %}

```javascript
bridge.remoteConfig.setContext({ segment: 'whales', level: 42 })
```

{% endtab %}

{% tab title="Unity" %}

```csharp
Bridge.remoteConfig.SetContext(new Dictionary<string, object>() { { "segment", "whales" }, { "level", 42 } });
```

{% endtab %}

{% tab title="Construct 3" %}
There is no separate action — add context parameters with the common `Add Action Parameter` / `Add Bool Action Parameter` actions right before `Send Remote Config Get Request` (see the example in [Load Values](#load-values)).
{% endtab %}

{% tab title="GDevelop" %}
There is no separate action — add context parameters with the common `Add Action Parameter` / `Add Bool Action Parameter` actions right before `Send Remote Config Get Request` (see the example in [Load Values](#load-values)).
{% endtab %}

{% tab title="Godot" %}

```gdscript
Bridge.remote_config.set_context({ "segment": "whales", "level": 42 })
```

{% endtab %}

{% tab title="GameMaker" %}

```javascript
playgama_bridge_remote_config_set_context(json_stringify({ segment: "whales", level: 42 }))
```

{% endtab %}

{% tab title="Defold" %}

```lua
bridge.remote_config.set_context({ segment = "whales", level = 42 })
```

{% endtab %}

{% tab title="Cocos Creator" %}

```javascript
bridge.remoteConfig.setContext({ segment: 'whales', level: 42 })
```

{% endtab %}
{% endtabs %}

## Load Values

Load remote values and merge them into your local defaults before gameplay starts. `get()` takes no arguments — pass segmentation parameters via `setContext()` beforehand.

{% tabs %}
{% tab title="Plain JS" %}

```javascript
bridge.remoteConfig.setContext({ segment: 'whales' }) // optional

bridge.remoteConfig.get()
    .then(data => {
        // your custom data, example: { showFullscreenAdOnStart: 'no', difficulty: 'hard' }
        console.log(data)
    })
    .catch(error => {
        // error
    })
```

{% endtab %}

{% tab title="Unity" %}

```csharp
private void Start()
{
    Bridge.remoteConfig.SetContext(new Dictionary<string, object>() { { "segment", "whales" } }); // optional
    Bridge.remoteConfig.Get(OnRemoteConfigGetCompleted);
}

private void OnRemoteConfigGetCompleted(bool success, Dictionary<string, string> data)
{
    if (success)
    {
        // your custom data, example: { showFullscreenAdOnStart: "no", difficulty: "hard" }
        foreach (var pair in data)
        {
            Debug.Log($"{pair.Key}: {pair.Value}");
        }
    }
    else
    {
        // error
    }
}
```

{% endtab %}

{% tab title="Construct 3" %}
In the event sheet:

1. On a trigger (e.g. **Button → On clicked**), optionally add context with **Add Action Parameter** / **Add Bool Action Parameter**, then run **Send Remote Config Get Request**.
2. Add the **On Remote Config Got Completed** condition. Inside it, check **Has Remote Config Value** for each key and read it with the `PlaygamaBridge.RemoteConfigValue("key")` expression.

{% hint style="info" %}
Read loaded values with the `PlaygamaBridge.RemoteConfigValue("key")` expression after checking the `Has Remote Config Value` condition.
{% endhint %}

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"add-action-parameter","objectClass":"PlaygamaBridge","parameters":{"key":"\"segment\"","value":"\"whales\""}},{"id":"send-remote-config-get-request","objectClass":"PlaygamaBridge"}]},{"eventType":"block","conditions":[{"id":"on-remote-config-got-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"has-remote-config-value","objectClass":"PlaygamaBridge","parameters":{"key":"\"difficulty\""}}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"PlaygamaBridge.RemoteConfigValue(\"difficulty\")"}}]}]}]}
```

</details>
{% endtab %}

{% tab title="GDevelop" %}
In the events sheet:

1. On a trigger (e.g. **Button is clicked**), optionally add context with **Add Action Parameter** / **Add Bool Action Parameter**, then run **Send Remote Config Get Request**.
2. Add the **On Remote Config Got Completed** condition. Inside it, check **Has Remote Config Value** for each key and read it with the `PlaygamaBridge::RemoteConfigValue("key")` expression.

{% hint style="info" %}
Read loaded values with the `PlaygamaBridge::RemoteConfigValue("key")` expression after checking the `Has "key" in Remote Config` condition.
{% endhint %}

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["Button",""]}],"actions":[{"type":{"value":"PlaygamaBridge::AddActionParameter"},"parameters":["","\"segment\"","\"whales\"",""]},{"type":{"value":"PlaygamaBridge::SendRemoteConfigGetRequest"},"parameters":["",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnRemoteConfigGotCompleted"},"parameters":["",""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::HasRemoteConfigValue"},"parameters":["","\"difficulty\"",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["PlaygamaBridge::RemoteConfigValue(\"difficulty\")","\"info\"",""]}]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>
{% endtab %}

{% tab title="Godot" %}
{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
func _ready():
    Bridge.remote_config.set_context({ "segment": "whales" }) # optional
    Bridge.remote_config.get(funcref(self, "_on_remote_config_get_completed"))

func _on_remote_config_get_completed(success, data):
    if success:
        # your custom data, example: { "showFullscreenAdOnStart": "no", "difficulty": "hard" }
        print(data)
    else:
        # error
        pass
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
func _ready():
    Bridge.remote_config.set_context({ "segment": "whales" }) # optional
    Bridge.remote_config.get(Callable(self, "_on_remote_config_get_completed"))

func _on_remote_config_get_completed(success, data):
    if success:
        # your custom data, example: { "showFullscreenAdOnStart": "no", "difficulty": "hard" }
        print(data)
    else:
        # error
        pass
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="GameMaker" %}

```javascript
playgama_bridge_remote_config_set_context(json_stringify({ segment: "whales" })) // optional
playgama_bridge_remote_config_get()

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_remote_config_get_callback" {
    if async_load[? "success"] {
        // your custom data, example: { showFullscreenAdOnStart: "no", difficulty: "hard" }
        var data = json_parse(async_load[? "data"])
    }
}
```

{% endtab %}

{% tab title="Defold" %}

```lua
local bridge = require("bridge.bridge")

function init(self)
	bridge.remote_config.set_context({ segment = "whales" }) -- optional

	bridge.remote_config.get(
		function (_, data)
			-- your custom data, example: { showFullscreenAdOnStart = "no", difficulty = "hard" }
			for key, value in pairs(data) do
				print(key, value)
			end
		end,
		function ()
			-- error
		end
	)
end
```

{% endtab %}

{% tab title="Cocos Creator" %}

```javascript
bridge.remoteConfig.setContext({ segment: 'whales' }) // optional

bridge.remoteConfig.get()
    .then(data => {
        // your custom data, example: { showFullscreenAdOnStart: 'no', difficulty: 'hard' }
        console.log(data)
    })
    .catch(error => {
        // error
    })
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Remote Config here is the **platform** feature (Yandex Remote Config). Bridge can also merge a remote copy of `playgama-bridge-config.json` over the local file on any platform — see the `remoteConfigUrl` option in [Setup](/playgama/bridge-sdk/setup.md).
{% endhint %}
