This repository contains the GameMonetize.com SDK for HTML5 games. This allows you to display advertisements in the games published within the GameMonetize.com network. https://GameMonetize.com
We offer also SDK for all Web3 Gaming Frameworks: Unity, Construct 3 (v2), Construct 2, Cocos2D and HTML5
Add following rows into your index.html file (head section or body section). Fill gameId and use SDK events when you need it (mute audio, pause game and after that resume game logic).
This code will initialize GameMonetize.com HTML5 SDK
<script type="text/javascript">
window.SDK_OPTIONS = {
gameId: "your_game_id_here",
onEvent: function (a) {
switch (a.name) {
case "SDK_GAME_PAUSE":
// pause game logic / mute audio
break;
case "SDK_GAME_START":
// advertisement done, resume game logic and unmute audio
break;
case "SDK_READY":
// when sdk is ready
break;
}
}
};
(function (a, b, c) {
var d = a.getElementsByTagName(b)[0];
a.getElementById(c) || (a = a.createElement(b), a.id = c, a.src = "https://api.gamemonetize.com/sdk.js", d.parentNode.insertBefore(a, d))
})(document, "script", "gamemonetize-sdk");
</script>- Make sure to add your game hash (GameId), which you can retrieve from your GameMonetize.com control panel.
- Invoke a method to pause AND mute your game within the SDK_GAME_PAUSE event. Will be called every time a video advertisement is ready to play. It is important that the game is muted, as background audio through video advertisements is forbidden.
- Invoke a method to resume your game within the SDK_GAME_START event. Will be called every time a video advertisement is done playing.
Now you must call sdk.showBanner() at the appropriate time in your game to show ads.
if (typeof sdk !== 'undefined' && sdk.showBanner !== 'undefined') {
sdk.showBanner();
}
Now you can upload the game (Root folder of .ZIP file must include index.html and game files) Go to Game Management > My games > Select you game > Drop file to upload.
Verify SDK by click on button "Verify Game". This shows you that you have correctly done integration and ready to publish.
Submit game - click on button REQUEST ACTIVATION
Answer: When your game is ready to upload, you need to compress all game files to .ZIP file - Root folder of .ZIP file must include index.html and game files
In the case where a developer wants to self-host their game, please contact us on at: [email protected]
If you have any technical questions or comments, please email us at: [email protected]
Or simply check documentation on: https://gamemonetize.com/sdk
