API call to update an audience segmentation rule.
The user must be authenticated and have write permissions to the siteGroup.
Request
The request object has the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
id |
String |
Yes |
Identifier for the audience segment rule to be updated. |
|
name |
String |
No |
Segment name. Maximum 32 characters. |
|
description |
String |
No |
Segment description. Maximum 250 characters. |
|
filters |
Array of Object |
No |
A list of filters that define a subset of the audience. The filter syntax is documented here . Note that the segment should include a time-filter to specify the length of time of event traffic to use as basis for the segment. If not, the time period the segment covers is undefined. The maximum time period is 30 days. |
|
annotations |
Array of Object |
No |
A list of key/value pairs that can be used to look up the segment (see /segment/read ). Note that this overwrites the entire list of annotations. Incremental add/update of individual annotations is not supported. Make sure to supply the entire list of annotations for the segment whenever one of them is updated. |
|
active |
boolean |
No |
Set to True to enable the segment for active usage. Explained here . |
|
internal |
boolean |
No |
Set to True to make the segment internal to protect from nonadmin altering. |
|
group |
String |
No |
Name of the segment group to assign this segment to |
|
expirationDate |
Number |
No |
The expiration date which shows when the current segment can be automatically deleted. |
|
includeUsersWithoutEvents |
boolean |
No |
Include users without events in export. |
Only the fields specified in the request will be updated.
Response
The response object for a successful query has the following fields:
|
Name |
Type |
Description |
|---|---|---|
|
|
String |
The identifier for the audience segment |
|
|
String |
The site group identifier to which this audience segment belongs |
|
|
String |
The name of this audience segment |
|
|
String |
A description for this audience segment |
|
|
String |
The type of the segment, either |
|
|
Array of object |
Array of filters that defines the segment. The filter syntax is documented here . |
|
|
Array of object |
Key/value pairs that can be used to look up the segment |
|
|
boolean |
True if segment is enabled for active usage. Explained here . |
|
|
String |
Name of the segment group bind with specified segment |
|
|
Array of String |
Widget IDs if segment is used in CCE. |
|
|
Number |
Pre-evaluated cost of the segment by the platform. Please note that for certain segments the cost can be unevaluated and hence unavailable, in which case in order to evaluate the cost, the /segment/validate API must be used instead. |
|
|
String |
The time the segment was last uploaded. |
|
|
String |
The expiration date which shows when the current segment can be automatically deleted. |
|
|
String |
True if the segment is compatible with contextual targeting. |
|
|
Array of String |
Segment IDs of all the segments that reference current segment either directly or through other segments. |
|
|
Array of String |
Segment IDs of all the segments that reference current segment directly. |
|
|
boolean |
Include users without events in export. |
Examples
# Before:
$ python cx.py /segment/read '{"id":"ff50970350bcc43ea10c022018a28b33bf8a404a"}'
{
"segments": [
{
"id": "ff50970350bcc43ea10c022018a28b33bf8a404a",
"siteGroupId": "10501",
"name": "Google-referrer",
"description": "Events with google as referrer",
"filters": [
{
"type": "event",
"group": "referrerHost",
"item": "google.com"
}
]
}
]
}
$ python cx.py /segment/update '{"id":"ff50970350bcc43ea10c022018a28b33bf8a404a", "name":"Social referrer", "description":"Events with google or facebook as referrer", "filters":[{"type":"time", "start":"-2d", "filter":{"type":"or", "filters":[{"type":"event", "group":"referrerHost", "item":"google.com"}, {"type":"event", "group":"referrerHost", "item":"facebook.com"}]}}]}'
{
"id": "ff50970350bcc43ea10c022018a28b33bf8a404a",
"siteGroupId": "10501",
"name": "Social referrer",
"description": "Events with google or facebook as referrer",
"filters": [
{
"type": "time",
"start": "-2d",
"filter": {
"type": "or",
"filters": [
{
"type": "event",
"group": "referrerHost",
"item": "google.com"
},
{
"type": "event",
"group": "referrerHost",
"item": "facebook.com"
}
]
}
}
],
"active": true
}