CoolGames SDK integration

We’re very excited to have your game on our network of sites! This tutorial will guide you through the steps to add and initialize the CoolGames SDK in your HTML5 game. Integrating the CoolGames SDK is a requirement before your game can be distributed on the CoolGames network.

If you have any questions about these requirements, please feel free to email your licensing manager, and if you have technical questions about implementation, e-mail dev-support@coolgames.com.

For design and technical requirements, please refer to CoolGames Design & Technical Guideline. We look forward to publishing your game!

Include the SDK

The first step is to implement the SDK in your game. To include the SDK add the following “publisher.js” javascript file to your index.html file inside of the HEAD tags.

This file contains SDK initialization so the game can properly access all of its functionality.

IMPORTANT: Don’t worry that you don’t have a local copy of the booster api.js file. This is located on our game servers and will work correctly once we upload your game into our system.

Device Orientation

The implementation of the SDK gives us the ability to add CoolGames required functionality such as the rotation screen.

Booster.Init function accepts an object with orientation parameter which can be “portrait”, “landscape” or “both”. Please set the value to your game’s default orientation.

Adding Ads to Your game

The most effective spot to place an ad call is at the end of each level (for either a success or a failure) as well when restarting or quitting a level. This prevents advertisements from interrupting the player in the middle of the game.

Regardless of how often you call the Advertising function, there is a minimum 1 minute cool-down between ads to prevent the player from being spammed. This is especially relevant for fast turn-around games like Flappy Bird.

For Ads implementation code see “pauseHandler” function in “game.js” example below.

Community features

If the game is hosted on a CoolGames environment, a small menu tab will appear in the game, which players can use for community features.

For posting high-scores, the SDK has it’s own high-score feature that is, in most cases, triggered at the end of a level.

For community features please see “submitScoreHandler” function in the “game.js” example below.

Analytics

The CoolGames SDK includes support for event tracking to see how players progress through a game. CoolGames uses these events, combined with our other analytics tools, to track game performance across the global network.

The CoolGames SDK includes three built-in events you should use at the appropriate locations in your game’s code. They are represented as “analytics” object and you can find them all in “game.js” example below.

Example

There is an example game with our SDK integrated. It is recommended to use the same structure for the SDK implementation in order to have easy access to add and change values within the “publisher.js” depending on the various portals we publish the games to.

We have shown “publisher.js” file contents above, now let’s see what the “index.html” file can look like:

And now the game itself:

Game Delivery

Once you’ve integrated the CoolGames SDK and implemented the relevant and required functionality, it’s time for you to prepare your complete game package for final submission.

You should submit your game as a download link (via dropbox, google drive, or any other cloud service) to your Licensing Manager.

Need Help?

If you have any questions about these requirements, please feel free to e-mail your licensing manager, and if you have technical questions about implementation, e-mail dev-support@coolgames.com.