Segment API¶
Segments enable you to profile the content displayed to specific users.
To manage segments, use the SegmentationService
.
Getting segment information¶
To load a segment group, use SegmentationService::loadSegmentGroupByIdentifier()
.
Get all segments assigned to the group with SegmentationService::loadSegmentsAssignedToGroup()
:
1 2 3 4 5 6 7 |
|
Similarly, you can load a segment by using SegmentationService::loadSegmentByIdentifier()
:
1 |
|
Checking assignment¶
You can check whether a user is assigned to a segment with SegmentationService::isUserAssignedToSegment()
:
1 2 3 4 5 |
|
Assigning users¶
To assign a user to a segment, use SegmentationService::assignUserToSegment()
:
1 |
|
Creating segments¶
Each segment must be assigned to a segment group.
To create a segment group, use SegmentationService::createSegmentGroup()
and provide it with a SegmentGroupCreateStruct
:
1 2 3 4 5 6 7 |
|
To add a segment, use SegmentationService::createSegment()
and provide it with a SegmentCreateStruct
, which takes an existing group as one of the parameters:
1 2 3 4 5 6 7 |
|
Updating segments¶
To update a segment or a segment group, use SegmentationService::updateSegment()
or SegmentationService::updateSegmentGroup()
and provide it with SegmentUpdateStruct
or SegmentGroupUpdateStruct
.
Deleting segments¶
To delete a segment or a segment group, use SegmentationService::removeSegment()
or SegmentationService::removeSegmentGroup()
:
1 |
|