Phaser API Documentation

  Version: 
saveStats(data)

Description:

Save the stats of the current player 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 is requested in an async call, so the result isn't available immediately.

When the call completes the savestats 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 savestatsfail event instead.

Parameters:

name type description
data object

An object containing a set of key-value pairs that should be persisted to cloud storage as stats. Note that only numerical values are stored.

Returns:
Description:

This Facebook Instant Games Plugin instance.

Since: 3.13.0