Embedding on another site + the score bridge
- Written for
- + Written for
- Deprecated
- + Deprecated
- Applies to
- + Applies to
AdminUpdated Sep 19, 2026
Embedding on another site + the score bridge
Every published game (with embedding on — the default; toggle per game) has a framable embed URL:
<iframe src="https://coolgptgames.com/embed/<slug>" width="100%" height="600"
style="border:0" allow="autoplay; fullscreen; gamepad"></iframe>The embedded game forwards score + lifecycle to the host page via postMessage, so a third-party site can show its own leaderboard. Attach the listener before you insert the iframe, and verify the origin:
window.addEventListener("message", (e) => {
if (e.origin !== "https://coolgptgames.com") return;
if (e.data?.source !== "coolgptgames") return;
// { source:"coolgptgames", v:1, type, game, score? }
switch (e.data.type) {
case "score": yourLeaderboard.record(e.data.game, e.data.score); break;
case "gameover": showPlayAgain(e.data.score); break;
case "ready": case "gamestart": break; // idempotent lifecycle (may repeat)
}
});Any game that calls GameSDK.submitScore / GameSDK.gameOver emits these — no game change needed. Only non-sensitive data crosses (never the player's token). Embedded games play as guests (cross-site storage isolation), so account features — persistent XP, cloud saves, ranked, global leaderboards — only work on coolgptgames.com; local gameplay and the score bridge work anywhere.
Was this page helpful?