The ZokoGames SDK is a small browser library that connects your game to the portal page that embeds it. This is the short tour. The SDK reference covers every module and method.
1. Load it#
<script src="https://sdk.zokogames.com/zokogames-sdk-v1.js"></script>
<script>
const SDK = window.ZokoGames.SDK;
</script>If you use a bundler, keep the script tag and read the global. The script URL carries the major version, v1.
2. Initialise#
await SDK.init();
if (SDK.environment === "disabled") return runStandalone();init() never rejects. It resolves once the SDK has chosen an environment: zokogames inside the portal, local on your own machine, or disabled. Every other member needs init() to have resolved first.
3. Say when the player is playing#
await SDK.game.gameplayStart();
// ... pause menu, death or result screen:
await SDK.game.gameplayStop();The portal uses this pair to measure real playtime, which feeds your basic launch metrics. Basic launch only needs gameplayStart; full launch needs both.
4. Save progress#
SDK.data mirrors localStorage, but the save follows a signed-in player across devices.
const level = Number(SDK.data.getItem("level") ?? "1");
function onLevelComplete(next) {
SDK.data.setItem("level", String(next));
}The four methods are synchronous because the whole save is loaded when init() resolves. Writes sync to the portal in the background. Values are strings, so use JSON.stringify for structured state.
5. Handle an ad break#
async function showMidgame() {
await SDK.ad.requestAd("midgame", {
adStarted: () => pauseAll(),
adFinished: () => {},
adError: () => {},
});
resumeAll();
}Pause and mute in adStarted, and resume whether the ad finished or failed. An ad can fail for ordinary reasons: ads are off during basic launch and for kids games, a player may use an ad blocker, and midgame ads are paced. Write your handler so an unknown code takes the safe path and the game carries on.
6. Test it#
- Local mode. Open your game from
localhostand the SDK answers from an in-page mock. Ads show a short placeholder overlay, so you can test every callback. Add?sdk_debug=trueto log every call. - Preview tool. Open /preview to run your game inside the real portal frame with a live requirements checklist and an event log.
Next: local testing, the SDK playground and the launch checklist.



