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 email@example.com.
For design and technical requirements, please refer to CoolGames Design & Technical Guideline. We look forward to publishing your game!
Include the SDK
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.
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.
Add the following code in the publisher.js file:
This is the config which loads some variables, for now they can use these test variables. Once ready to publish we will place the production id’s there. Next to this, when in-game the rewarded ads should be shown, the following call must be made:
After the onComplete callback, the developer should make sure that the game flow will be continued accordingly.
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.
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.
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:
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.
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 firstname.lastname@example.org.