Funox SDK
The Funox SDK is a single drop-in script (or engine plugin) that handles everything your game needs to integrate with Funox: lifecycle signals, ads, banners, user accounts, save data, leaderboards, and in-game purchases.
Install
HTML5 / JavaScript
1<script src="https://sdk.funox.com/funox-sdk-v1.js"></script>1await window.Funox.SDK.init();If await isn't available, use the promise form:
1window.Funox.SDK.init()2 .then(() => { /* ready */ })3 .catch((err) => console.warn('Funox SDK init failed', err));Other engines
Each supported engine has its own package and initialization pattern. Pick yours:
SDK modules
The SDK is split into a small number of modules:
| Module | Purpose |
|---|---|
game | Lifecycle signals: gameplay start/stop, loading, happytime |
ad | Midgame and rewarded video ads |
banner | Display banner ads on menus and results screens |
user | Player accounts: sign-in, profile, tokens, friends |
data | Persist player data across devices (up to 1 MB) |
leaderboards | Submit and fetch scores |
iap | In-game purchases via Xsolla |
Environment
Check where the SDK is running:
1window.Funox.SDK.environment; // "local" | "funox" | "disabled"| Value | Meaning |
|---|---|
local | Running on localhost or 127.0.0.1. Demo ads are shown. |
funox | Running in production on a Funox domain. |
disabled | Running somewhere unrecognized — SDK calls no-op safely. |
To force local mode anywhere, append ?useLocalSdk=true to your game's URL.
Error handling
All SDK methods return a structured error when something goes wrong:
1{2 code: "userCancelled",3 message: "The user cancelled the sign-in prompt"4}Wrap async calls in try/catch and branch on error.code. Common codes are documented per module.
Versioning
- The SDK URL above (
funox-sdk-v1.js) is pinned to major version 1. - We may release
funox-sdk-v2.jsin the future — your game keeps using v1 until you opt in. - Changelog is published in the Developer Portal.