Skip to content

SDK Documentation 📃

Intention of events

Thanks to our developer-friendly SDK, you can easily oversee the most important metrics of your game simply by firing a couple of SDK events during various moments in the game. This information includes, but is not limited to:

  • Daily Playing Users: The amount of page visitors and the percentage of users who are able to play the game.
  • Engagement: Average time players spends in game. Also shows how much time is spent on loading or ads.
  • Earnings: Ad-related metrics such as total earnings, or the distribution of impression types.
  • Error Scanner: Details for all of errors of the past 24 hours, updated hourly.
  • Player Feedback: Details on player rating and comments.

Definition of events

  •  ⌛ gameLoadingFinished() : Pretty self-explanatory, we’d say. We need this to track the loading progress of your game and show your conversion to play.
  •  🎮 gameplayStart() : Fires whenever the player starts interacting with the game (e.g. when the player starts moving around or clicks to interact with something.).
  •  ☠ gameplayStop() : Fires whenever the gameplay halts (e.g. when the game is paused, the level is completed or when the player is dead).
  •  🎞 commercialBreak() : Fires with the natural stops in the game (e.g. between levels, restarting a level, or basically any scenario where the player is about to go back into the gameplay stage).
  •  🎬 rewardedBreak() : Fires with user prompt in exchange for an in-game reward (e.g. unlocking gold or bonus items, revival after death, or any scenario where you can convince the player to watch an ad).

Example order of events:

  • Startup:  ⌛ gameLoadingFinished()  >  🎮 gameplayStart() 
  • Player dies and restarts:  ☠ gameplayStop()  >  🎞 commercialBreak()  >  🎮 gameplayStart() 
  • Player dies and revives:  ☠ gameplayStop()  >  🎬 rewardedBreak()  >  🎮 gameplayStart() 
  • Player goes to next level:  ☠ gameplayStop()  >  🎞 commercialBreak()  >  🎮 gameplayStart() 
  • Player goes to next level with double rewards:  ☠ gameplayStop()  >  🎬 rewardedBreak()  >  🎮 gameplayStart() 
  • Player pauses / unpauses:  ☠ gameplayStop()  >  🎮 gameplayStart() 

Note: if an ad is fired when gameplay is not interrupted (for example if the player watches an ad to unlock a character skin), it’s not necessary to fire a  ☠ gameplayStop()  or  🎮 gameplayStart()  event.

Testing of events

Our Inspector is designed to help test your game and the implementation of the SDK events easily. Simply drag and drop your game folder that contains an index.html file and you’re set.

The tool will run the game as if it’s live on the platform, so you can test the game’s behavior on any device or browser. The tool also outputs the event log, so you can check if the SDK events are firing correctly.

Versioning with CLI

The Poki for Developers command line utility allows you to upload game builds directly from your terminal or CI-pipeline. Please check our Github repository for more information on installation.

Full examples

If you’d like to see a full example of the SDK implementation for each game engine, check these links out:

HTML5  |  Unity  |  GameMaker  |  Phaser 3