Submit statistics/scores to the server
submit(statistic_name, value)

Statistics Client API

Submitting statistics from your game using the Client API couldn't be easier. First, make sure you have read the documentation about how to define statistics for your game on the Kongregate servers.

Submitting statistics

The API for submitting a statistic to our servers is very simple. The submit function on the stats property of the Kongregate API Object takes two arguments. The first is the name of the statistic as you defined earlier, and the second is an integer for the value:

Name

Type

Description

statistic_name

String

The name of the statistic to submit.

value

Integer

The value of the statistic to submit.

Example: Submit various statistics to the server

kongregate.stats.submit("Coins", 1); // The user collected a coin
kongregate.stats.submit("MonstersKilled", 1); //The user killed a monster
kongregate.stats.submit("HighScore", 398); //The user got a score of 398
kongregate.stats.submit("LapTime", 60); //User finished a lap in 60 seconds
kongregate.stats.submit("Coins", 1); // The user collected a coin
kongregate.stats.submit("MonstersKilled", 1); //The user killed a monster
kongregate.stats.submit("HighScore", 398); //The user got a score of 398
kongregate.stats.submit("LapTime", 60); //User finished a lap in 60 seconds