Did you find this helpful?
Players: Segment Configuration
Segment Configuration Page allows you to configure new or existing segment: adjust name, define filters, assign tasks. Each segment allows you to define useful or interesting groups of players, and perform exclusive actions on that group.
How to create/access segment
To access Segment configuration, navigate to "Players" tab (1). Then select "Segments" sub-tab (2). Then you can choose:
- Use "New Segment" button (3) to create and configure new segment
- Locate existing segment and click it's name label (4) to configure this segment
How to configure a segment
- Players with and without a distinctive characteristic defined in PlayFab
- A defined Cloud Script PlayStream Hook
In this example we are going to:
- Configure a segment using the "defining characteristic" - all players that come from Canada.
- Run a Cloud Script function "helloWorld" for each player that enters the segment.
The "defining characteristic" of a player can be among: Login time, Linked device type, tags, real-world location, statistic values, virtual currency values, or real money purchases, and more. Player country is one of many possible options, and only specifically required for this example. Feel free to replace the country requirement with another filter of your choice.
When segment is defined, you have a variety of action options to run when player enters or leaves the segment. Cloud Script is by far the most flexible action, granting you full control of the player and segmentation information at the time of segment-transition. Utilize the second parameter, "context" in your Cloud Script handler to identify the player, and segment transition. Afterwards, perform any action you wish on the player, such as granting inventory items, virtual currency, player data, or statistics.
In this particular case, segment configuration requires 4 simple steps
- Assign good, appropriate name for the segment following your defining characteristic - "Canada Players"
- Assign conditions that player has to meet to enter the segment. In this case we want Country filter with a strict value: "Canada".
- Add "Cloud Script" action for "Entered Segment" trigger. Configure the action to run the function we want: "helloWorld"
Advanced Segment Filtering
Segment filtering allows you to define what players are included into the segment. Formally speaking, segment (1) is a set of players that belong to at least one group. Group (2) is a set of players that meet all defined conditions (called filters (3)).
In other words, to be part of segment, player must be part of at least 1 group. To be part of group, player must meet all conditions (filters). This is denoted by OR/AND operators: filters are combined using AND operator, while groups are combined using OR operator.
The screenshot above is an example of how segment can be defined. This segment consists of 2 groups. First group is defined by 2 filters: player must be from canada and must have Apple push notifications enabled. Second group is also for players from Canada, but they must have Google push notifications enabled. In the end, we have a segment of players from Canada with either Google or Apple push notifications.
Each filter has unique configuration and purpose. As of 4/30/2017 the following filters are available:
- All Players filter has no configuration and is unique, because it allows to create a segment of all players. This comes in handy when you want to run automatic operations for every new player (Segment actions are described later in the document)
- First login (date) filter allows to filter based on first login datetime. Ex: players that have first logged in after 1/1/2017
- First login (timespan) filter allows to filter based on first login timespan relative to current datetime. Ex: players that have first signed in 20 minutes ago (from now)
- Last login (date) filter allows to filter based on last login datetime. Ex: players that have not signed since 1/1/2017
- Last login (timespan) filter allows to filter based on last login timespan relative to current datetime. Ex: players that have not signed signed for a week (from now).
- Linked user account to filter allows to filter based on users' linked accounts . Ex: players that have Steam account linked with email
- Location (country) filter allows to filter based on player's country. Ex: players from Canada
- Push notifications enabled with filter allows to filter based on player push settings and capabilities. Ex: players that have Google push notifications enabled
- Statistics value filter allows to filter based on your own custom statistic attribute. Ex: players that inflicted 20000 damage in total
- Tag filter allows to filter based on if player has/doesn't have certain tag. Ex: players that have "cheater" tag
- Total value to date in USD filter allows to filter based on how much USD currency player spent in your game. Ex: players that have spent over $30
- Value to date filter allows to filter based on how much of certain currency player spent in your game. Ex: players that have spent 50 RUB
- User Origination filter allows to filter based on first authentication method that player used to start playing the game. The trick here is that player may start with authentication based on, say, iOS Device ID. Later player may have GameCenter account linked. In this case player origination will be iOS Device ID. Ex: players that first signed in using iOS Device ID
- Virtual currency balance filter allows to filter based on player's custom virtual currency deposit. Ex: players that have less than 50 Crystal
Each action needs a trigger, in order, to run. Some actions are run manually, triggered right from the page. Sometimes, though, you have to select a trigger - an event that causes action to run. Trigger defines the context of the action. For example. "Player Entered Segment" trigger passes you the context containing reference to the player. General workflow for action panel is the following:
- Select event condition a.k.a trigger
- Select action type. PlayFab offers a variety of actions. If, at any point, you need more flexible action, consider "Cloud Script" action. This action type allows you to run your own Cloud Script function.
- Configure the action (specific for each action type).
- Remove action from the trigger
- Add action to the trigger
How to inspect player segments
It is possible to look up what segments player belongs to by means of Player Segments Page. To access Player Segments, select "Players" in the sidebar menu (1). Then select "Players" tab (2). Locate the player you want to inspect and click the ID label (3). Finally select "Segments" in the Players Toolbar (4).
- Player ID label identifies player you currently inspecting
- Segment table contains list of all segments player belongs too. Click segment name label to configure segment.