Retrieves a list of all segments where the user is a member.
For using this method as part of a Javascript integration, see the ready integration guide at DMP segments helper function - getUserSegmentIds() .
The user must be authenticated and have read permissions to the specified site group.
Request
The request object has the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
Array of Strings |
Yes |
The list of site groups to retrieve segments for. |
|
|
String |
No |
Identifies the user whose segment memberships should be returned. |
|
|
String |
No |
The type of user identifier, i.e., tells us how to interpret /traffic/data , or a site-specific id obtained from |
|
|
Array of Objects |
No |
A list of user identifiers to consult if multiple identities are available. |
|
|
Array of String |
No |
Deprecated Please use |
|
|
Array of Object |
No |
Recommended together with |
|
|
String |
Defaults to |
The response format, and must be either Real Time Config (RTC) response format. |
|
|
String |
Defaults to |
The segment format, one of |
Either a single identifier and type, or a list of objects must be specified.
The identities objects have the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
String |
Yes |
The identifier for the user. See the ' |
|
|
String |
Yes |
The customer identifier type. See the ' |
Each candidateSegments object has the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
String |
Yes |
The segment identifier. |
|
|
String |
Yes |
The segment type. One of 'traffic', 'external' or 'lookalike'. |
Response
The cx-formatted response object has the following fields:
|
Name |
Type |
Description |
|---|---|---|
|
|
Array of Strings |
List of segment identifiers where the user is a member. |
The cx_typed-formatted response object has the following fields:
|
Name |
Type |
Description |
|---|---|---|
|
|
Array of Objects |
List of segments where the user is a member. |
Each segments object has the following fields:
|
Name |
Type |
Description |
|---|---|---|
|
|
String |
The segment identifier. |
|
|
String |
The shortened segment identifier. |
|
|
String |
The segment type. One of 'traffic', 'external' or 'lookalike'. |
The rtc-formatted response object has the following fields:
|
Name |
Type |
Description |
|---|---|---|
|
|
Object |
An object contains the field |
Examples
# Single lookup
$ python cx.py /profile/user/segment '{"id":"hvfufdee4dai1giaud", "type":"cx", "siteGroupIds":["92028378393"]}'
{
"segments": [
"8pbc50ol8ryj",
"83rpijvh8u7d"
]
}
# Provide candidate when checking whether a user is a member of a specific segment
$ python cx.py /profile/user/segment '{"id":"hvfufdee4dai1giaud", "type":"cx", "siteGroupIds":["92028378393"], "candidateSegmentIds":["8pbc50ol8ryj","123"]}'
{
"segments": [
"8pbc50ol8ryj"
]
}
# Lookup using multiple identifiers for a single user
$ python cx.py /profile/user/segment '{"siteGroupIds":["92028378393"], "identities":[{"type":"xyz", "id":"subscriber14"},{"type":"cx","id":"hvfufdee4dai1giaud"}]}'{
"segments": [
"8pbc50ol8ryj",
"83rpijvh8u7d"
]
}
# Single lookup when rtc enabled
$ python cx.py /profile/user/segment '{"id":"hvfufdee4dai1giaud", "type":"cx", "siteGroupIds":["92028378393"], "format": "rtc"}'
{
"targeting":{
"CxSegments": [
"8pbc50ol8ryj",
"83rpijvh8u7d"
]
}
}
# New extended format for segment matches
$ python cx.py /profile/user/segment '{"id":"hvfufdee4dai1giaud", "type":"cx", "siteGroupIds":["92028378393"], "candidateSegments":[{"type": "traffic", "id": "8pbc50ol8ryj"},{"type": "external", "id": "123"}]}, "format": "cx_typed"'
{
"segments": [{
"type": "traffic", "id": "8pbc50ol8ryj", "shortId": "0"
}]
}