Skip to content

Gameplay signals

AI Summary

A short gist of this page, generated for you.

Powered by AI. Summaries can miss nuance — when in doubt, read the page.

These calls tell Funox what is happening in your game: when the player is actively playing, when they stop, and when something exciting happens. They drive session tracking and analytics.

Required

gameplayStart() and gameplayStop() are two of the four required calls.

#gameplayStart()

Call when the player begins or resumes active gameplay: a level starts, the player un-pauses, or a new run begins.

javascript
FunOxSDK.gameplayStart();
Not on loading screens or menus

Call it when the player is actually playing — not while assets load, and not on the main menu.

#gameplayStop()

Call when active gameplay stops: the pause menu opens, a level finishes, the game is over, or the player moves to a non-gameplay screen.

javascript
FunOxSDK.gameplayStop().then(function () {
  showGameOverScreen();
});

Every gameplayStart() should eventually be followed by a gameplayStop().

#happyTime()

Call when the player achieves something significant — a personal best, finishing a hard level, defeating a boss. Funox uses it as a positive engagement signal.

javascript
FunOxSDK.happyTime();

Use it sparingly, for moments that really are special.

#reportActivity()

The SDK already notices clicks, key presses and touches inside your game, and Funox stops counting play time after 90 seconds without any. Call reportActivity() only during long stretches with no input that the player is still watching, such as a cutscene.

javascript
// Every 30 seconds while a cutscene plays
FunOxSDK.reportActivity();

#Putting it together

javascript
FunOxSDK.init().then(showMainMenu, showMainMenu);

// Player taps Play
function onPlayPressed() {
  FunOxSDK.gameplayStart();
  startLevel();
}

// Player opens the pause menu
function onPause() {
  FunOxSDK.gameplayStop();
}

// Player returns to the game
function onResume() {
  FunOxSDK.gameplayStart();
}

// Player beats their high score
function onNewHighScore() {
  FunOxSDK.happyTime();
}

// Player dies
function onGameOver() {
  FunOxSDK.gameplayStop();
  showGameOverScreen();
}