> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure XBOX stats and stat rules in Partner Center

> Add and change stat rules in Partner Center for data platform 2013, so player stats update when your title sends events to XBOX services.

This topic describes the procedures for adding and changing stat rules in the Partner Center service configuration for a title. Player stats are created and updated according to the stat rules triggered when a game sends events to the XBOX Live service.

For an introduction to XBOX service configuration, see [Service configuration](/services/xbox-services/fundamentals/portal-config/live-service-config-ids-mp). For an introduction to Data Platform 2013, see the XDK topic **How the XBOX Live data platform 2013 works**.

<a id="ID4EMB" />

## What is a stat rule?

Stat rules are triggered when the XBOX data platform service receives an event with a particular name. Triggering a stat rule (by sending an appropriate event) causes the service to create or update one or more player stats.

You define player stats, the XBOX Live data platform calculates them, and they are stored as name-value pairs on a per-user basis. Here are a few examples of player stats.

* Total number of zombies killed with a shotgun in hard difficulty
* Highest number of enemies defeated in a match
* Fastest time for completing a race
* Name of the car driven most recently

Player stats can be displayed on the player's game hub UI as featured or hero stats, displayed in leaderboards, and used to unlock achievements.

Individual stat rules can be configured to produce one of the following:

* A single instance of a player stat
* Multiple instances of a player stat that's based on a stat template

For information about stats and stat rules, see the following topics in the XDK documentation.

* **User Stats for Data Platform 2013**
* **User Stat Rules**
* **User Stats Scenarios**

The following diagram demonstrates the flow of an event that triggers stat rules that update stat instances.

<img src="https://mintcdn.com/microsoft-4404708b/66WJ_HwgXG1cFJFn/publishing/game-publishing/how-to/data-platform-2013/media/dataplatformtaxonomy-documentation-01-event_to_stat.jpg?fit=max&auto=format&n=66WJ_HwgXG1cFJFn&q=85&s=b981fb7b2e9b8f7e613b91515ffdf747" alt="Event flow" width="1280" height="720" data-path="publishing/game-publishing/how-to/data-platform-2013/media/dataplatformtaxonomy-documentation-01-event_to_stat.jpg" />

<a id="ID4ENC" />

## Configure a stat rule

<Steps>
  <Step title="Sign in with your account on [Partner Center](https://developer.microsoft.com...">
    Sign in with your account on [Partner Center](https://developer.microsoft.com/dashboard/windows/overview).
  </Step>

  <Step title="Select your title, and then go to **Services** > **XBOX Live**.">
    Select your title, and then go to **Services** > **XBOX Live**.
  </Step>

  <Step title="Select the link to **Stat rules**.">
    Select the link to **Stat rules**.
  </Step>

  <Step title="On the **Events and stat rules** page, configure the events and the stat rule...">
    On the **Events and stat rules** page, configure the events and the stat rules that are based on those events.
  </Step>
</Steps>

Because stat rules are based on events, you must create an event before you can create a stat rule. For details, see [Configure XBOX Live events for data platform 2013 in Partner Center](/publishing/game-publishing/how-to/data-platform-2013/how-to-configure-events-2013).

<a id="ID4ELC" />

## Create a stat rule

1. On the **Events & Stat Rules** page, select **New stat rule**.
2. In the **Add Stat Rule** dialog, specify the values for the following fields.
   * **Base event**<br />In the dropdown list, select the base event that triggers this stat rule.
   * **Event fields added to the stat rule**
     * This optional field lets you select fields included in the base event as part of the stat rule.
     * In the dropdown list, select a field to add to the stat rule. You can add multiple fields this way. The selected fields are appended to the stat rule's root name and separated by the dot character.
     * To remove a field, select the X next to its name.
   * **Stat Rule Name**<br />Specify a name that characterizes the stat rule and that you'll easily remember and recognize. Names of stat rules are composed of a *root* name, optionally followed by one or more *fields* separated by the dot character. For the naming requirements of stat rule names, see the XDK topic **User Stat Rules**.
   * **Operator**<br />Select one of the following operators.
     * **Sum**<br />Increment the existing stat value by the value specified in the **Parameter** field.
     * **Min**<br />Use the minimum of the existing stat value and the **Parameter** field's value.
     * **Max**<br />Use the maximum of the existing stat value and the **Parameter** field's value.
     * **Replace**<br />Replace the stat value with the value specified in the **Parameter** field. We don't recommend using the **Replace** operator for stats that drive achievements. Events aren't always processed in order, and this might cause an achievement to never unlock. Instead, use the **SUM** operator.
   * **Parameter**<br />Specify the value to use in the operator selected in the **Operator** field.
     * If you want to use a static number that you specify, select the **literal** option and then specify the value in the box below the option.
     * If you want to use the value of a field, select the **field** option and, in the dropdown list below the option, select the field to use.
   * **Restrict other features like achievements and featured stats from accessing this info.**<br />Select this checkbox to make the stat rule private.
   * **Only allow changes to this stat from a server event. Client events will be ignored.**<br />Select this checkbox to indicate that the stat rule is triggered only by events sent via the server-to-server API, not from game clients running on the console or PC.
3. After configuring all fields and values, select **Save** and then close the dialog.

Your new stat rule is now listed on the **Events & Stat Rules** page whenever the rule's event is selected.

<a id="ID4E2C" />

## Change an existing stat rule

<Warning>
  After a title passes Final Certification, existing stat rules for an event in that title can no longer be changed or deleted.
</Warning>

1. In the **Stat rules** column on the **Events and stat rules** page for the product instance, select the stat rule you want to change.
2. Make the changes in the **Update stat rule** dialog for the event.
3. Select **Save**.

<a id="ID4ELE" />

## Edit a stat rule

Editing a stat rule takes place when a stat rule's name or an event field has been removed, added, or reordered. This operation is treated as a deletion and creation of a new stat rule. All stat instances are deleted as part of editing, according to this definition.

<a id="ID4EMS" />

## Copy an existing stat rule

<Warning>
  After a title passes Final Certification, existing stat rules for an event in that title can no longer be changed or deleted.
</Warning>

1. On the **Events and stat rules** page for the product instance, find the row with the stat rule you want to delete.
2. Select **Copy** in the **Actions** column on that row.
3. Make the changes in the **Update stat rule** dialog for the event.
4. Select **Save**.

<a id="ID4EMF" />

## Delete an existing stat rule

<Warning>
  * After a title passes Final Certification, existing stat rules for an event in that title can no longer be changed or deleted.
  * Deletion of a stat rule is a permanent action and can't be undone or reversed.
  * Deleting a stat rule deletes any chained dependencies it might have. Before deleting a stat rule, be sure that you also want to delete all its dependencies.
</Warning>

1. On the **Events and stat rules** page for the product instance, find the row with the stat rule you want to delete.
2. Select **Delete** in the **Actions** column on that row.
3. Select **Delete** in the **Confirmation** dialog.

<img src="https://mintcdn.com/microsoft-4404708b/66WJ_HwgXG1cFJFn/publishing/game-publishing/how-to/data-platform-2013/media/event_delete_dependency.png?fit=max&auto=format&n=66WJ_HwgXG1cFJFn&q=85&s=18f149e565417485187df9a2a9ae1fab" alt="Event delete dependency" width="624" height="297" data-path="publishing/game-publishing/how-to/data-platform-2013/media/event_delete_dependency.png" />


## Related topics

- [Configure featured stats in Partner Center](/publishing/game-publishing/how-to/data-platform-2013/how-to-configure-featured-stats.md)
- [Configure stat change notifications in Partner Center](/publishing/game-publishing/how-to/data-platform-2013/how-to-configure-stat-notifications.md)
- [Configure XBOX events in Partner Center](/publishing/game-publishing/how-to/data-platform-2013/how-to-configure-events-2013.md)
- [Configure XBOX data platform 2013 in Partner Center](/publishing/game-publishing/how-to/data-platform-2013/how-to-configure-data-platform-2013.md)
- [Configure achievements in Partner Center](/publishing/game-publishing/how-to/data-platform-2013/how-to-configure-achievements-2013.md)
