Playgama Bridge Config

This section describes the structure of the playgama-bridge-config.json file, which is used to configure the SDK.

The default file structure looks like this:

{
    "platforms": {
        "game_distribution": {
            "gameId": ""
        },
        "telegram": {
            "adsgramBlockId": ""
        },
        "y8": {
            "gameId": "",
            "adsenseId": "",
            "channelId": ""
        },
        "lagged": {
            "devId": "",
            "publisherId": ""
        },
        "msn": {
            "gameId": ""
        },
        "discord": {
            "appId": ""
        }
    },
    "advertisement": {
        "interstitial": {
            "preloadOnStart": true,
            "placements": []
        },
        "rewarded": {
            "preloadOnStart": true,
            "placements": []
        },
        "banner": {
            "placements": []
        },
        "useBuiltInErrorPopup": true,
        "backfillId": "",
    },
    "payments": [],
    "leaderboards": []
}

Platforms section

In this section you can set up various identifiers required by platforms. If you are not publishing the game on a specific platform, you can delete the corresponding lines.

Advertisement section

In this section you can configure how advertising works.

Preload On Start

The preloadOnStart parameter is responsible for whether the ad should be automatically preloaded at start (supported on some platforms, affects the speed of displaying the ad after calling the showInterstitial / showRewarded methods).

To enable you can specify a true or specific placement.

{
    "advertisement": {
        "interstitial": {
            "preloadOnStart": "test_interstitial_placement"
        }
    },
    ...
}

Placement Fallback

You can add the placementFallback parameter. If the placement is not specified in the game code, then this placement will be used when calling showBanner, showInterstitial, showRewarded methods.

{
    "advertisement": {
        "banner": {
            "placementFallback": "test_banner_placement",
            ...
        },
        "interstitial": {
            "placementFallback": "test_interstitial_placement",
            ...
        },
        "rewarded": {
            "placementFallback": "test_rewarded_placement",
            ...
        }
    },
    ...
}

Placements

You must fill in the array of placements used in the game. Each placement must have an id. You can override which placement is sent to the platform's native SDK.

{
    ...
    "advertisement": {
        "interstitial": {
            "placements": [
                {
                    "id": "test_interstitial_placement",
                    "facebook": "facebook_overrided_placement",
                    "<ANY_PLATFORM_ID_HERE>": "<OVERRIDED_PLACEMENT_FOR_PLATFORM_HERE>"
                }
            ]
        },
        // same for banner or rewarded
        ...
    }
    ...
}

In the example above, if the game code calls a method showInterstitial("test_interstitial_placement") and the game is running on Facebook, the facebook_overrided_placement will be passed to the Facebook native SDK.

Error Popup

Platforms like MSN and Facebook require that after an unsuccessful ad display a popup with a message appears. You can make it yourself in the game, or use the parameter useBuiltInErrorPopup to use the built-in one.

{
    ...
    "advertisement": {
        "useBuiltInErrorPopup": true
        ...
    }
    ...
}

Payments section

In this section you can configure in-game purchases.

Each product must have an id (it must be used in the game code when working with methods purchase, consume, getCatalog, getPurchases) and the necessary information for the platforms.

For the Playgama.com platform, you must specify the price in Gam.

For the Playdeck platform, you must specify the price in Telegram Stars and a description.

For other platforms that support payments, additional data is not required (it is filled in the developer account on the platform).

{
    ...
    "payments": [
        {
            "id": "test_product",
            "playgama": {
                "amount": 1 // int price in Gam
            },
            "playdeck": {
                "amount": 1, // int price in Telegram Stars
                "description": "TEST PRODUCT"
            }
        }
    ]
}

Leaderboards

In this section you can configure leaderboards. For each leaderboard add an id. You can override which id is sent to the platform's native SDK.

{
    ...    
    "leaderboards": [
        {
            "id": "test_leaderboard", // use this id in game logic
            "yandex": "yandex_overrided_leaderboard_id",
            "<ANY_PLATFORM_ID_HERE>": "<OVERRIDED_ID_FOR_PLATFORM_HERE>"
        },
        {
            "id": "test_leaderboard_2", // use this id in game logic
            "<ANY_PLATFORM_ID_HERE>": "<OVERRIDED_ID_FOR_PLATFORM_HERE>"
        }
    ]
}

In the example above, if the game code calls a method setScore("test_leaderboard", 42) and the game is running on Yandex, the yandex_overrided_leaderboard_id will be passed to the Yandex native SDK.

Last updated