Segments API
Integration of segments through SDK. Methods of operation.
List of methods
Properties:
gp.segments.list
- list of segments.
Checks:
gp.segments.has()
- check if the player is in the segment.
Events:
gp.segments.on('enter')
- subscribe to the moment of entering a segment.gp.segments.on('leave')
- subscribe to the moment of leaving a segment.
Properties
List of segments
You have access to the entire list of segments at once when the game starts and the player loads, in the format of a string array.
gp.segments.list;
Example content:
[
'HAS_PAYMENTS',
'VIP',
'NEWBLE',
'VERY_ACTIVE'
]
Checks
Segment check
gp.segments.has(tag)
// By Tag
const hasPayments = gp.segments.has('HAS_PAYMENTS');
// Check
if (hasPayments) {
// Player is in the HAS_PAYMENTS segment
}
Events
Enter segment
The callback returns the segment tag as a string:
gp.segments.on('enter', (segmentTag) => {
// player entered the segment
});
Leave segment
The callback returns the segment tag as a string:
gp.segments.on('leave', (segmentTag) => {
// player left the segment
});
Stay in Touch
Other documents of this chapter available Here. To get started, welcome to the Tutorials chapter.
GamePush Community Telegram
: @gs_community.
For your suggestions e-mail
: [email protected]
We Wish you Success!