Back to blog
Engineering

Integrating leaderboards with postMessage

A quick developer guide to submitting scores from embedded HTML5 games using the gp:submitScore protocol.

Embedded games on Kithplay can submit scores without custom backend code. When the player achieves a new best, send a message to the parent window:

window.parent.postMessage({ type: "gp:submitScore", value: score }, "*");

The value must be a positive integer. The portal ignores submissions from logged-out players but still lets guests play. Scores appear on the game leaderboard after a short refresh.

Call this once per run at game over — do not spam messages every frame. For testing, open your game page while logged in and verify the leaderboard updates after a refresh.

Integrating leaderboards with postMessage | Kithplay