Kongregate Developers

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:

submit(statName:String,value:Number):void
  • statName:String - The name of the statistic
  • value:Number - The value to submit (will be converted to an integer)

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

Comments