> ## 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.

# Advanced Segmentation with Player Custom Properties

> Build dynamic PlayFab player segments from Custom Properties set via APIs, Game Manager, or PlayStream rules to power actions and scheduled live ops tasks.

# Advanced Segmentation with Custom Properties (Public Preview)

<Note>
  The Advanced Segmentation with Custom Properties feature is in private preview. We anticipate ongoing changes to it as we continue gathering feedback and optimizing for customer use.
</Note>

Advanced Segmentation with [Custom Properties (Public Preview)](/services/playfab/live-service-management/game-configuration/segmentation/player-custom-properties) enables dynamic player segments using your own commerce, engagement, and custom data. You can store and manage player's custom information using Custom Properties and then use it to create segments based on those specific properties. These properties can be set on players via APIs, Game Manager, or PlayStream rules, and can be used to define segments that group players based on shared characteristics. Once these segments are created, they can be used to generate actions on players. Additionally, these segments can be used to define scheduled or manual tasks.

## Creating segments with Player Custom Properties

You can create segments with Player Custom properties either via API or Game manager.

### Via API

* Use the [Create Segment API](https://learn.microsoft.com/en-us/rest/api/playfab/admin/segments/create-segment) to create a segment.
* Add custom property predicates using the [Update Segment](https://learn.microsoft.com/en-us/rest/api/playfab/admin/segments/update-segment) API.

### Via Game Manager

* Sign in to [Game Manager](https://developer.playfab.com).
* Go to the **Players** page.
* Go to the **Segments** tab.
* [Create or update a segment](/services/playfab/live-service-management/game-configuration/segmentation/segmentation-quickstart).
* Add custom property predicates by selecting **Add filter** under **Player**.
* Save segment.

## Exporting players from a segment with custom properties

1. [Create a segment](/services/playfab/live-service-management/game-configuration/segmentation/segmentation-quickstart) that references custom property predicates.
2. Use the [ExportPlayersInSegment API](/services/playfab/live-service-management/game-configuration/segmentation/segmentation-export-players-in-a-segment) to export player profiles

## Scheduled Tasks

1. [Run scheduled task](/services/playfab/data-analytics/acting-data/scheduled-tasks) on a segment using custom property predicates.

## Quick Start Scenarios

### Set up Economy V2 Catalog and Inventory

1. Create a **Gold Bar** currency as an item.
2. Create a **Chocolate Bar** currency as an item.
   * **Required parameters:** Friendly ID, Title, and Start Date (March 1)\\
     <img src="https://mintcdn.com/microsoft-4404708b/IwSYTY5BEqd_x-HK/images/playfab/data-analytics/acting-data/advanced_segmentation_docs_2_economy_currencies.png?fit=max&auto=format&n=IwSYTY5BEqd_x-HK&q=85&s=4d7717a09bb5a874d243bccd92600354" alt="Economy V2 Catalog Setup" width="1715" height="578" data-path="images/playfab/data-analytics/acting-data/advanced_segmentation_docs_2_economy_currencies.png" />
3. Create a catalog item **Chocolate Bar**:\
   3a. Navigate to **Settings -> Economy (V2) -> Catalog (V2)**.\
   3b. Under **Catalog Settings**, add a new **Content Type** - **Chocolate Bar** and select **Save**.

   <img src="https://mintcdn.com/microsoft-4404708b/IwSYTY5BEqd_x-HK/images/playfab/data-analytics/acting-data/advanced_segmentation_docs_3_economy_settings.png?fit=max&auto=format&n=IwSYTY5BEqd_x-HK&q=85&s=a8cc51e057c5f9605d157092b51f92b8" alt="Catalog Settings" width="1184" height="900" data-path="images/playfab/data-analytics/acting-data/advanced_segmentation_docs_3_economy_settings.png" />

   3c. Go to **Engage -> Economy -> Catalog (V2) -> Items**, then select on **New item** to add.

   <img src="https://mintcdn.com/microsoft-4404708b/IwSYTY5BEqd_x-HK/images/playfab/data-analytics/acting-data/advanced_segmentation_docs_4_economy_new_item.png?fit=max&auto=format&n=IwSYTY5BEqd_x-HK&q=85&s=db3b3f74eec0156f06d22c91c77ed450" alt="New Item" width="1717" height="570" data-path="images/playfab/data-analytics/acting-data/advanced_segmentation_docs_4_economy_new_item.png" />

   3d. Select **Chocolate Bar** under **ContentType**, set a **Start date**, **Time**, and **Title**, then select **Save and Publish**.

   <img src="https://mintcdn.com/microsoft-4404708b/IwSYTY5BEqd_x-HK/images/playfab/data-analytics/acting-data/advanced_segmentation_docs_5_create_chocolate_bar.png?fit=max&auto=format&n=IwSYTY5BEqd_x-HK&q=85&s=3fc3d43286a7a0a5c27ae713dc6fb90b" alt="Save and Publish" width="1495" height="757" data-path="images/playfab/data-analytics/acting-data/advanced_segmentation_docs_5_create_chocolate_bar.png" />

***

### 1. Create a Segment for Users Who Spend Between 25-50 Gold Bars (Virtual Currency Spent)

1. Navigate to the **PlayStream Rules** page under **Automation -> Rules**.

2. Create a rule for the `items_subtracted` event with the following configuration:

   **Conditions:**

   * `Payload.ItemId == <id of Gold Bar currency>`
   * Optional: `Payload.Amount` between 25 and 50 to prevent overwrites of other amounts

   **Actions:**

   * Update custom properties
     * `AmountSpent = Payload.Amount`
     * `ItemName = Payload.ItemId`

   <img src="https://mintcdn.com/microsoft-4404708b/IwSYTY5BEqd_x-HK/images/playfab/data-analytics/acting-data/advanced_segmentation_docs_6_gold_sub_rule.png?fit=max&auto=format&n=IwSYTY5BEqd_x-HK&q=85&s=d60daa6e9d15493bda013cfddc1b277b" alt="Virtual Currency Rule Configuration" width="1361" height="784" data-path="images/playfab/data-analytics/acting-data/advanced_segmentation_docs_6_gold_sub_rule.png" />

3. Navigate to the **Segments** page under **Players -> Segments**.

4. Create a new segment with the following configuration:

   * Custom property (string) `ItemName` is `<Gold Bar id>`
   * Custom property (numeric) `AmountSpent` is `>= 25`
   * Custom property (numeric) `AmountSpent` is `<= 50`

   <img src="https://mintcdn.com/microsoft-4404708b/IwSYTY5BEqd_x-HK/images/playfab/data-analytics/acting-data/advanced_segmentation_docs_7_gold_segment.png?fit=max&auto=format&n=IwSYTY5BEqd_x-HK&q=85&s=b231ad97b5ae4bdac45fca1fd4d27a76" alt="Virtual Currency Segment Configuration" width="842" height="845" data-path="images/playfab/data-analytics/acting-data/advanced_segmentation_docs_7_gold_segment.png" />

***

### 2. Create a Segment for Users Who Were Granted Chocolate Bars and Used All of Them (10) After April 1, 2025 (Inventory Granted)

1. Navigate to the **PlayStream Rules** page under **Automation -> Rules**.

2. Create a rule for the `playfab.inventory.items_granted` event with the following configuration:

   **Conditions:**

   * `Payload.ItemId == <Chocolate Bars id>`

   **Actions:**

   * Update player custom properties
     * `AmountSpent = Payload.Amount`
     * `ItemUpdateDate = Timestamp`

   <img src="https://mintcdn.com/microsoft-4404708b/IwSYTY5BEqd_x-HK/images/playfab/data-analytics/acting-data/advanced_segmentation_docs_8_chocolate_sub_rule.png?fit=max&auto=format&n=IwSYTY5BEqd_x-HK&q=85&s=762437c85d96129ed24e7b85dfbcbf32" alt="Inventory Granted Rule Configuration" width="1341" height="833" data-path="images/playfab/data-analytics/acting-data/advanced_segmentation_docs_8_chocolate_sub_rule.png" />

3. Navigate to the **Segments** page under **Players -> Segments**.

4. Create a segment with the following configuration:

   * Custom property (string) `ItemName = <Chocolate Bars id>`
   * Custom property (datetime) `ItemUpdateDate > 4/1/2025`
   * Custom property (numeric) `ItemAmountSpent >= 10`

   <img src="https://mintcdn.com/microsoft-4404708b/IwSYTY5BEqd_x-HK/images/playfab/data-analytics/acting-data/advanced_segmentation_docs_9_chocolate_segment.png?fit=max&auto=format&n=IwSYTY5BEqd_x-HK&q=85&s=c41112d6e5b2c6661ae1a28712c53ef5" alt="Inventory Granted Segment Configuration" width="899" height="1250" data-path="images/playfab/data-analytics/acting-data/advanced_segmentation_docs_9_chocolate_segment.png" />

5. **How it Works:** The rule will **update** the player custom property with the value from each individual event—**it will not accumulate or sum values over time**. For example, if a player spends 1 chocolate bar ten separate times, the `ItemAmountSpent` property will be set to `1` each time, not `10`. As a result, the player would **not** be included in the segment that filters for `ItemAmountSpent >= 10`. If you need to track cumulative or aggregated values (e.g. total items spent across multiple events), we recommend implementing custom logic using an **Azure Function** or **CloudScript** to calculate and update the total.

6. **Note:** Gold Bars in Scenario 1 and Choclate Bars in Scenario 2 both write to the same property `ItemName`. If you want to track multiple values, you'll need multiple property names to prevent thrashing a player between 2 segments.

***

### 3. Create a Segment for Users Who Purchased 1 Chocolate Bar in One Purchase (Catalog Purchase)

1. Navigate to the **PlayStream Rules** page under **Automation -> Rules**.

2. Create a rule for the `playfab.inventory.items_purchased` event with the following configuration:

   **Conditions:**

   * `Payload.ItemType == ChocolateBar`
   * `Payload.Amount >= 1`
   * `Timestamp >= 5 minutes ago`

   **Actions:**

   * Update custom properties
     * `ChocolateBarPurchased = Payload.Amount`

   <img src="https://mintcdn.com/microsoft-4404708b/IwSYTY5BEqd_x-HK/images/playfab/data-analytics/acting-data/advanced_segmentation_docs_10_chocolate_purchase_rule.png?fit=max&auto=format&n=IwSYTY5BEqd_x-HK&q=85&s=e0dabaa54932a0f2e7e0ed7898cbdb2b" alt="Catalog Purchase Rule Configuration" width="1686" height="1080" data-path="images/playfab/data-analytics/acting-data/advanced_segmentation_docs_10_chocolate_purchase_rule.png" />

3. Navigate to the **Segments** page under **Players -> Segments**.

4. Create a segment with the following configuration:

   * Custom property (numeric) `ChocolateBarPurchased >= 1`

   <img src="https://mintcdn.com/microsoft-4404708b/IwSYTY5BEqd_x-HK/images/playfab/data-analytics/acting-data/advanced_segmentation_docs_11_chocolate_purchase_segment.png?fit=max&auto=format&n=IwSYTY5BEqd_x-HK&q=85&s=0690da9ce0f5575e8e1d19a201a2f557" alt="Catalog Purchase Segment Configuration" width="626" height="1255" data-path="images/playfab/data-analytics/acting-data/advanced_segmentation_docs_11_chocolate_purchase_segment.png" />

5. **How It Works:**  Whenever a player purchases a **Chocolate Bar**, the rule condition triggers, executing the action to add the custom property. The player then enters the segment and can receive the configured reward or notification.
