Skip to main content
Licensed
Client-side callbacks let your app or website respond when a game loads, a player starts a gameplay, or their score changes. A gameplay is a single run of a game, from the moment the player starts playing until the game ends. If the player plays again, a new gameplay starts. All the gameplays from when the game loads until the game page is refreshed or reloaded make up one session.
Complete the shared client-side callback setup before loading the game, then return here for Individual Games event definitions and payloads.

How callbacks work

Each time something happens in the game, such as the score changing, the game sends a callback to your app or website straight away. The callback’s state field says what happened, and score gives the current score. Your app decides what to do with it, as in this example:
Client-side callbacks run on the player’s device, so use them for things like updating your UI or recording analytics. When you need a trusted score, for example before giving out rewards, use server-side webhooks instead.

Events

TriggerThe game has finished loading.Example payload
Payload notesA fresh game sends a score of 0. The gamePlayId and duration fields are not sent with this event. Wait for start before treating the player as having started a gameplay.
TriggerThe player starts a new gameplay.Example payload
Payload notesBoth score and duration are 0. This state can occur again when the player retries within the same session.
TriggerThe player’s score changes during gameplay.Example payload
Payload notesUpdates can arrive repeatedly throughout a gameplay. Use the latest score to update your UI.
TriggerThe gameplay ends.Example payload
Payload notesThe score is the final score for that gameplay. A player can play again, so one session can contain several over events.
TriggerThe player completes a level in a level-based game.Example payload
Payload notesThis state applies to level-based games. It reports a level completion rather than the end of the gameplay.

Payload fields

Depending on the platform, your callback handler receives each payload as an object or a JSON string. The examples above show the decoded JSON. Not every field appears in every event, so ignore any fields you don’t recognise instead of rejecting the payload. These are client payloads. For server-side delivery and its separate payload fields, see Server-side webhooks.