Phaser API Documentation

  Version: 
incStats(data)

Description:

Increment the stats of the current player and save them to the designated cloud storage.

Stats in the Facebook Instant Games API are purely numerical values paired with a string-based key. Only numbers can be saved as stats, all other data types will be ignored.

The data object provided for this call should contain offsets for how much to modify the stats by:

this.facebook.incStats({
    level: 1,
    zombiesSlain: 17,
    rank: -1
});

The data is requested in an async call, so the result isn't available immediately.

When the call completes the incstats event will be emitted along with the data object returned.

If the call fails, i.e. it's not in the list of supported APIs, or the request was rejected, it will emit a incstatsfail event instead.

Parameters:

name type description
data object

An object containing a set of key-value pairs indicating how much to increment each stat in cloud storage. Note that only numerical values are processed.

Returns:
Description:

This Facebook Instant Games Plugin instance.

Examples:
Since: 3.13.0