Skip to main content

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

HTML1 line
1<script src="https://sdk.funox.com/funox-sdk-v1.js"></script>
JavaScript1 line
1await window.Funox.SDK.init();

If await isn't available, use the promise form:

JavaScript3 lines
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:

ModulePurpose
gameLifecycle signals: gameplay start/stop, loading, happytime
adMidgame and rewarded video ads
bannerDisplay banner ads on menus and results screens
userPlayer accounts: sign-in, profile, tokens, friends
dataPersist player data across devices (up to 1 MB)
leaderboardsSubmit and fetch scores
iapIn-game purchases via Xsolla

Environment

Check where the SDK is running:

JavaScript1 line
1window.Funox.SDK.environment; // "local" | "funox" | "disabled"
ValueMeaning
localRunning on localhost or 127.0.0.1. Demo ads are shown.
funoxRunning in production on a Funox domain.
disabledRunning 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:

JavaScript4 lines
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.js in the future — your game keeps using v1 until you opt in.
  • Changelog is published in the Developer Portal.

Next steps

  • Integrate the game module first — it's required for Basic Launch.
  • Add ads and banner once your gameplay is stable.
  • Layer in user, data, and leaderboards when you're ready.