Docs menu Events
Events and the order of calls
Last updated 2026-11-19
Your game sends the page a few events with the SDK. The page uses them to show its loading bar, to time ads, to offer the next game, and to fill your dashboard. This page shows which calls to make at common moments.
The game starts
| Step | Call |
|---|---|
| The script has loaded | init() |
| Loading begins | loadingStart() |
| While files load | loadingProgress(0.1) up to loadingProgress(1) |
| The first screen takes input | loadingFinished() |
| The player presses Play | gameplayStart() |
If your game goes straight into play with no menu, call loadingFinished() and then gameplayStart() right after it.
Game over and play again
| Step | Call |
|---|---|
| The player loses | gameplayStop(), then gameEnd('loss') |
| Your game over screen shows | nothing |
| The player presses Play again | await commercialBreak(), then gameplayStart() |
The break goes on the button press, so the ad shows when the player has chosen to go on.
A revive with a rewarded ad
| Step | Call |
|---|---|
| The player loses a life | gameplayStop() |
| The player presses “Watch an ad to keep going” | await rewardedBreak() |
rewarded is true |
Revive, then gameplayStart() |
rewarded is false |
Show the game over screen, then gameEnd('loss') |
The next level
| Step | Call |
|---|---|
| The player clears a level | gameplayStop(), and happyTime() for a great result |
| The player presses Next | await commercialBreak(), then gameplayStart() |
Don’t call gameEnd() between levels. It shows a card of other games to play, which is right at the end of a run, and wrong in the middle of one.
A pause menu
| Step | Call |
|---|---|
| The menu opens | gameplayStop() |
| The menu closes | gameplayStart() |
A match in a multiplayer game
| Step | Call |
|---|---|
| The lobby shows | nothing (play hasn’t started) |
| The match starts | gameplayStart() |
| The match ends | gameplayStop(), then gameEnd('win'), gameEnd('loss') or gameEnd('draw') |
| Back in the lobby | await commercialBreak() before the next match |
What the page does with each event
| Call | What the page does | Where you see it |
|---|---|---|
loadingProgress() |
Moves its loading bar | Nothing to measure |
loadingFinished() |
Hides the bar, loads its banners around the game | Load time, Loaded |
gameplayStart() |
Starts counting play time, hides the next-games card | Plays, conversion |
gameplayStop() |
Stops counting play time | Gameplay time per play |
gameEnd() |
Ends the round for the ad rules, shows the next-games card 2.5 seconds later | Round ends in your events |
commercialBreak() |
Shows an interstitial if the ad rules allow one | Ad results |
happyTime() |
Shows a “Nice one!” note | Nothing to measure |
Warnings in the console
The SDK writes a warning in the browser console when:
gameplayStart()comes twice in a row:gameplayStart() called twice in a row. Call gameplayStop() when play stops.gameplayStop()comes with no start before it:gameplayStop() called with no gameplayStart() before it.
The event_order check in the check report looks for the same mistakes, and also for play while an ad is on screen.