GameFoundry

Help Center/Code & engines

Reporting runs from your game (GameFoundry.start and gameOver)

Two optional lines that tell GameFoundry when a run starts and ends, for accurate play statistics.

When a game is played on GameFoundry, a small GameFoundry object is available to it. Call GameFoundry.start() when a run begins (the Start or Play again button, a retry) and GameFoundry.gameOver(score) when it ends (death, loss, time up or a win). The score is optional and must be a number. Guard both calls with "if (window.GameFoundry)" so the game still works anywhere else.

GameFoundry uses these to count runs, repeat players and scores for your game, and to show signed-out players the sign-up invitation at a natural break, right after a game over, rather than mid-play. Games built with Prompt to Browser Game include the calls automatically.

Games without the calls still work: GameFoundry estimates runs from pauses in play (a stretch of play, a few seconds with no input, then input again). Adding the two calls just makes the numbers exact.

Nothing personal is collected for these statistics: visitors are counted with an anonymous identifier that changes every day, and no cookies are used for them.

Tip

Call start() for every new attempt, including "next level" in games where losing a level ends the run, so retries are counted correctly.