Access
Connect cross-platform accounts & identity management
AccelByte Cloud’s Statistics service gives game developers persistent statistics 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 Cloud Profile (opens new window) service.
AccelByte Cloud’s 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 (opens new window) are used to grant access to specific resources within our services. Make sure your account has the following permissions before you attempt to manage achievements in the Admin Portal. For a full list of permissions that impact achievements management, see the Social tab of the permissions reference (opens new window).
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 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 (opens new window) or are Roles (opens new window) assigned to users. For more information, see our Cloud Authentication and Authorization (opens new window) documentation.
Follow the steps below to add a new configuration:
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 is used when you create an Incremental Achievement (opens new window) or Leaderboard (opens new window). These Cloud services use player statistics to determine achievement conditions and generate leaderboards.
Follow the steps below to edit a statistics configuration:
In the Admin Portal, go to the Game Management section, expand the Statistics section, and select the Configurations menu.
In the Statistic Configurations page, click More Options (...) under the Action column, then click View.
On the Statistic Configuration page, you can edit the Name, Description, and Default Value of the selected statistic by clicking the pencil button.
In the Admin Portal, go to the Game Management section, expand the Statistics section, and select the Statistics Value menu.
Use the drop down to search for a player by Email, Display Name, User Name, or User ID.
Click View next to the player whose statistics you want to see.
On the Statistics Values page, you can see detailed information about the player’s statistics.
Navigate to the detail of the player’s statistics, as shown in the previous steps.
Choose the statistic you want to edit and click the pencil icon under the Current Value column.
Make any changes.
When you’re finished, click the blue tick button to save your changes.
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.
In this section, you will learn how to use the Client SDKs to manage the statistics for a player.
Use the following code to create a new statistic item for a player.
Use the following code to increment the user statistic items. You can increment multiple statistic codes with certain values simultaneously.
Use the following code to retrieve a player’s statistic by a specific StatCodes or Tags. This call return will only contain stat items specified by statCodes and tags.
Use the following code to retrieve all stat items.
Use the following code to reset a player's statistics to the default values in your game namespace. You can specify which statistics to reset.
NOTE
Resetting multiple statistics is not supported yet in the Unreal Engine AccelByte plugin.
Use the following code to update multiple statistics. There are four update strategies that you can use.
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. |
EXAMPLE
Suppose you want to implement a ranking system for your game. Whenever your players lose a match, their stats value decreases, meaning they go down a rank. To do this, you can use the INCREMENT strategy with a negative value to subtract the value and set the Increment field to False.
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 section, you will learn how to set up your statistics using the Game Server.
Use the following code to create a new statistic for a player from your game server.
Use the following code to increment the user statistic items from the server. You can increment multiple statistic codes with certain values simultaneously.
Use the following code to create multiple statistics for multiple players simultaneously.
Use the following code to retrieve a player’s statistic from the server by a specific StatCodes or Tags. This call return will only contain stat items specified by statCodes and tags.
Use the following code to retrieve all stat items from the server.
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.
NOTE
Resetting multiple statistics for multiple players from the server is not supported yet in the Unreal Engine AccelByte plugin.
Use the following code to update multiple statistics for a player using the updating strategy options.
Use the following code to update multiple statistics for multiple players using the updating the strategy options.
Before you can use the Statistics service from one of the server-side SDKs, you will need to initialize the server-side SDK to ensure you are authorized and able to perform create, read, update, and delete actions.
Before you can use the Statistics service from the Golang SDK, you will need to initialize the SDK by following the steps below:
Once you have completed these steps, you can use the Golang SDK to create, read, update, or delete Statistics (opens new window) from your serverless app.
To use the Cloud Statistics Service, make sure you have the necessary permissions (opens new window).
Before you can use the Statistics service from the Python SDK, you will need to initialize the SDK by following the steps below:
Once you have completed those steps, you can use the Python SDK to manage statistics from your serverless app.
Before you can use the Social service, you will need to set some permissions (opens new window). Use the following .NET namespaces to do this:
using AccelByte.Sdk.Api.Social.Model;
using AccelByte.Sdk.Api.Social.Operation;
using AccelByte.Sdk.Api.Social.Wrapper;
Before you can use the Social service, you will need to set some permissions (opens new window). To do this, initialize the StatConfiguration wrapper from the Social service using the following code:
StatConfiguration wStatConfig = new StatConfiguration(sdk);
Once you have completed this step, you can use the SDK to manage 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 configuration (opens new window) based on a keyword:
Use the following function to update a statistic configuration (opens new window):
← Profile Cloud Save →