Game SDK

Step 1: Register an account

Log in to the management terminal and create a developer account.

Step 2: Creating a Game

On the management side, select Create Game under Developers to create a new game, and fill in the necessary game information after creation.

Step 3: Accessing SDK in the game

1.Initialize the SDK

Place gamebridge-sdk.js in the head area, and the loading order must be before the game script.

<script
	id="gamebridge-sdk"
	src="https://sdk.beesads.com/v1/gamebridge.js"
	data-test="on"
	data-gameid="{gameId}">
</script>

Parameter Info

  • id: Script fixed mark, must be passed

  • src: Script fixed loading address, must be passed

  • data-test: Whether to enable test ads. This parameter is used for ad debugging. This parameter needs to be cleared in the production environment. Available values: 'on', 'off'

  • data-gameid: The unique game ID is generated after the game is created on the management side and must be passed

After gamebridge-sdk.js is loaded, the GameBridgeSDK object will be mounted on the window, and the initialization method will be executed through the object: window.GameBridgeSDK.init().

// Execute the initialization function
window.GameBridgeSDK.init().then(() => {
    // It is recommended to execute the game initialization method here
});

2.Loading Event

Game resource loading event, through which developers can pass to the SDK when resource loading starts and ends.

// Called when game resources start loading, it will automatically trigger the pre-roll ad
window.GameBridgeSDK.gameLoadingStart();

// Called after the game resources are loaded successfully
window.GameBridgeSDK.gameLoadingFinished();

3.Config

Developers can configure the SDK by mounting the GAME_BRIDGE_CONFIG object on the window. Currently supported configuration items include: pause and resume. When an ad is called or ends, the SDK will perform corresponding operations on the game through the pause and resume methods in the configuration items.

window.GAME_BRIDGE_CONFIG = {
	// Register game pause event
	pause: () => {
		// How to pause the game
	}, 
	
	//Register for game resume event
	resume: () => {
		// How to pause the game
	}
}

4.Game Event

In order to better analyze game behavior, developers need to call the following methods at the appropriate location, such as calling window.GameBridgeSDK.gameplayStart() at the beginning of a level game.

// Turn-based games: Start
window.GameBridgeSDK.roundStart();

// Turn-based games: End
window.GameBridgeSDK.roundEnd();

// Level game: Start
window.GameBridgeSDK.gameplayStart();

// Level game: End
window.GameBridgeSDK.gameplayStop();

// Happy Moments
window.GameBridgeSDK.happyTime();

5.Get SDK status

SDK ready status

// Get whether the SDK is ready through window.GameBridgeSDK.ready
if (window.GameBridgeSDK.ready) {
    // Already continued
} else {
    // Not continued
}

Whether the current device has ads disabled

if (window.GameBridgeSDK.isAdBlocked()) {
    //Ads are disabled on this device
} else {
    // The current device does not disable ads
}

6.Show Ad

commercialBreak

commercialBreak is used to display interstitial ads and should be triggered at the end of a level or other time points during a break.

window.GameBridgeSDK.commercialBreak(() => {
    // Before calling function
}).then((status) => {
	// Call the completion function, where the parameter status returns the current ad display status
});

rewardedBreak

rewardedBreak is used to display rewarded ads, and the user should be able to choose whether to trigger it (for example, after completing a game, the user can choose to watch an ad to earn more revenue).

window.GameBridgeSDK.rewardedBreak().then((status) => {
	// Call the completion function, where the parameter status returns the current ad display status
});

Step 4: Submit your game

In the game list on the management end, select the version function to enter the version list. Create a new version and submit the game package.

Step 5: Game Review

Waiting for game verification, usually takes three working days

Step 6: Game Release

After the game is verified, it will be released.

Last updated