Access
Connect cross-platform accounts & identity management
The Statistics service provides game developers with persistent statistic tracking for their games. Tracked statistics include gameplay-related stats such as kill, die, and assist, and internal game data such as map played and game modes played. Statistics are tied to players and can be easily integrated or displayed as game profile attributes through the game profile service.
The statistics service also acts as the reference point for consistent value tracking across other services such as Progression, Achievements, and Leaderboards. We use messaging to update statistics values asynchronously to other related services in real-time. You only need to define the statistics you want to measure once, and they’ll be applied to all related services.
Permissions are used to grant access to specific resources within our services. Make sure your account has the following permissions before you attempt to manage statistics in the Admin Portal:
Usage | Permission Tag | Action |
---|---|---|
Create a New Statistic Configuration | ADMIN:NAMESPACE:{namespace}:STAT | Create |
Create a Single Statistic for a Player | ADMIN:NAMESPACE:{namespace}:USER:{userId}:STATITEM | Create |
Create a Multiple Statistics for a Player | ADMIN:NAMESPACE:{namespace}:USER:{userId}:STATITEM | Create |
Retrieve All of a Player’s Statistics | ADMIN:NAMESPACE:{namespace}:USER:{userId}:STATITEM | Read |
Update a Single Statistic for a Player | ADMIN:NAMESPACE:{namespace}:USER:{userId}:STATITEM | Update |
Update Multiple Statistics for Multiple Players | ADMIN:NAMESPACE:{namespace}:USER:{userId}:STATITEM | Update |
Retrieve Global Statistics | ADMIN:NAMESPACE:{namespace}:USER:{userId}:STATITEM | Read |
Permissions work slightly differently depending on whether they are assigned to IAM Clients or Roles assigned to users. For more information, read the Authentication and Authorization documentation.
In the Admin Portal, go to the Game Management section, expand the Statistics section, and select the Configurations menu.
In the Statistic Configurations window, click the Add Configuration button.
The Add New Configuration form will appear. Fill in the required fields.
Input the statistic code or StatCode in the Code field, following the formatting rules given.
NOTE
StatCode will be used when you create an Incremental Achievement and Leaderboard as those services will use player's statistics to determine the achievement condition and generate the leaderboard.
Input the Name of the configuration.
Input a Description of the configuration. This field is optional.
Define the minimum value of the statistic in the Min. Value field.
Define the maximum value of the statistic in Max. Value field.
Input the Default Value of the statistic.
Choose the Increment value. If set to True, the stat value can only be increased. If False, the stat value can be increased or decreased.
Choose the Set as Global value. If set to True, every time the stat is updated the global stat value will also be updated.
Select the Set By value. You can choose game client or game server. This determines which client will update the stat value.
Input the Tag field with contextual information related to the statistic. This field is optional.
In the Admin Portal, go to the Game Management section, expand the Statistics section, and select the Statistics Value menu.
Search for a player using the by using Email, Display Name, Username or by using User ID search filter. You can input the specific value that corresponds to the user you’re looking for.
Click View on the action panel of the desired player.
On the Statistics Values page, you can see detailed information about the player’s statistics.
On a player’s Statistics Value page, choose the statistic you want to edit and click the pencil icon under the Current Value column. Once you have made a change, click the blue tick button to save.
In the Admin Portal, go to the Game Management section, expand the Statistics section, and select the Statistics Value menu.
Switch to the Global tab. Here you’ll see the global statistics.
You can manage your statistics using the Client or Game Server. In this tutorial, you will learn how to set up the SDK using the Client Server.
Use the following code to create a new statistic for a player.
Use the following code to create multiple new statistics for a player.
Use the following code to retrieve a player’s statistic by a specific StatCodes or Tags.
Use the following code to retrieve all of your players’ statistics.
Use the following code to reset a player's statistic to the default values as specified in your game namespace.
Use the following code to update multiple statistics. There are 4 update strategies that you can use to handle the strategy.
Update Strategy | Usage |
OVERRIDE | Update a player’s StatItem value. |
INCREMENT | Add to or subtract from a player’s StatItem value. |
MAX | Update a player’s StatItem with a specified value greater than the current value. |
MIN | Update a player’s StatItem with a specified value lower than the current existing value. |
You also can use additionalKey to add more additional information about the player. The additionalKey parameter is added as a suffix to userId and is used to support multi-level players' stat items such as character stat items. If provided, the user's stat items will be saved with the key userId_additionalKey.
You can manage your statistics using the Client or Game Server. In this tutorial, you will learn how to set up the SDK using Game Server.
Use the following code to create a new statistic for a player from your game server.
Use the following code to multiple statistics for a player simultaneously.
Use the following code to create multiple statistics for multiple players simultaneously.
Use the following code to retrieve a player’s statistics by StatCodes or Tags.
Use the following code to retrieve all players’ statistics.
Use the following code to reset multiple statistics for a player to the default values as specified in your game namespace.
Use the following code to reset multiple players’ statistics to the default values as specified in your game namespace.
Use the following code to update multiple statistics for a player using the updating strategy (opens new window) options.
Use the following code to update multiple statistics for multiple players using the updating the strategy (opens new window) options.
Before using the Statistics service from the SDK, you will need to initialize your server-side SDK to make you authorized and able to perform create, read, update, and delete actions.
Before using the Statistics from the Golang SDK, you will need to initialize the SDK by following the steps below:
Once completed, you can use the Golang SDK to create, read, update, or delete Statistics (opens new window) from your serverless app.
Before using the Statistics service from the Python SDK, you will need to initialize the SDK by following the steps below:
Once completed, you can use the Python SDK to create, read, update, or delete Statistics (opens new window) from your serverless app.
Before using the Social service, you will need to set some permissions. Use the following .NET namespaces:
using AccelByte.Sdk.Api.Social.Model;
using AccelByte.Sdk.Api.Social.Operation;
using AccelByte.Sdk.Api.Social.Wrapper;
Before using the Social service, you will need to set some permissions. Initialize the StatConfiguration wrapper from the Social service using the following code:
StatConfiguration wStatConfig = new StatConfiguration(sdk);
Once completed, you can use the SDK to create, read, update, or delete a player’s statistics from your game client.
Use the following function to create a statistic configuration (opens new window):
Use the following function to delete a statistic configuration (opens new window):
Use the following function to retrieve a statistic configuration (opens new window):
Use the following function to retrieve all statistic configurations: (opens new window):
Use the following function to search for a statistic configuration (opens new window) based on a keyword:
Use the following function to update a statistic configuration (opens new window):
← Profile Cloud Save →