Skip to main content

Create a new segment

POST 

/segments

Create a new segment with given parameters

Request

Body

required

    audienceTracking boolean

    Segment is used in audience

    conditionsData

    object

    required

    Conditions by which visitors will be segmented

    firstLevel

    object[]

    First level conditions. Every level can have many conditions inside. E.g. we have 'firstLevelOrOperators' = [true], 'firstLevel'=[{OrOperators:[false], conditions: [SKY_STATUS, DAY_NIGHT]}, {OrOperators:[true], conditions: [PAGE_TITLE, NEW_VISITORS]}]. Then the expression will look like (SKY_STATUS AND DAY_NIGHT) OR (PAGE_TITLE OR NEW_VISITORS)

  • Array [

  • conditions

    object[]

    Add conditions (see TargetingConditionIO) to define a segment. The more conditions you add, the more precise your segment will be.

  • Array [

  • oneOf

    Includes or excludes visitors according to the time elapsed since the beginning of the session

    targetingType stringrequired

    Targeting condition type. According to this field it's necessary to add some additional fields

    Possible values: [PAGE_URL, PAGE_TITLE, LANDING_PAGE, ORIGIN, ORIGIN_TYPE, REFERRERS, NEW_VISITORS, BROWSER_LANGUAGE, GEOLOCATION, DEVICE_TYPE, SCREEN_DIMENSION, VISITOR_IP, AD_BLOCKER, PREVIOUS_PAGE, KEY_PAGES, PAGE_VIEWS, FIRST_VISIT, LAST_VISIT, ACTIVE_SESSION, TIME_SINCE_PAGE_LOAD, SAME_DAY_VISITS, VISITS, VISITS_BY_PAGE, INTERNAL_SEARCH_KEYWORDS, TABS_ON_SITE, HEAT_SLICE, SKY_STATUS, TEMPERATURE, DAY_NIGHT, FORECAST_SKY_STATUS, FORECAST_TEMPERATURE, DAY_OF_WEEK, TIME_RANGE, HOUR_MINUTE_RANGE, JS_CODE, COOKIE, EVENT, EXPLICIT_TRIGGER, BROWSER, OPERATING_SYSTEM, DOM_ELEMENT, MOUSE_OUT, TARGET_EXPERIMENT, TARGET_PERSONALIZATION, EXCLUSIVE_EXPERIMENT, CONVERSIONS, CUSTOM_DATUM, YSANCE_SEGMENT, YSANCE_ATTRIBUT, TEALIUM_BADGE, TEALIUM_AUDIENCE, PRICE_OF_DISPLAYED_PAGE, NUMBER_OF_VISITED_PAGES, VISITED_PAGES, SEGMENT, KEY_MOMENT, CUSTOM, SDK_LANGUAGE, VISITOR_CODE, EXCLUSIVE_FEATURE_FLAG, TARGET_FEATURE_FLAG, APPLICATION_VERSION]

    weight int32required

    More important conditions have greater values. Default value: 1

    Example: 1
    count int32

    Count of time elapsed since session became active according to the 'unitOfTime' field

    include boolean

    Should visitors who match to the condition be included to or excluded from the segment. Default value: 'true'

    matchType string

    How to match the specified amount of time

    Possible values: [EQUAL, LOWER, GREATER]

    unitOfTime string

    What unit of measurements will be used to define if sessions are active for the required duration

    Possible values: [SECOND, MINUTE, HOUR, DAY]

  • ]

  • orOperators boolean[]

    Array of booleans ("or"=true, "and"=false) for binding conditions of second level.

  • ]

  • firstLevelOrOperators boolean[]

    Array of booleans ("or"=true, "and"=false) for binding firstLevel outer conditions.

    description string

    Description of segment

    Example: The segment is for new ab tests
    isFavorite boolean

    Indicates whether the segment is considered as favorite.

    name stringrequired

    Name of segment

    Example: My segment
    segmentType stringrequired

    Segment type refers to the classification of segments based on their usage.

    Possible values: [STANDARD, KEY_MOMENT, FEATURE_FLAG, ALL]

    siteId int64required

    Unique identifier of site for which the segment is going to be or was created

    Example: 8372
    tags string[]

Responses

Created

Schema

    audienceTracking boolean

    Segment is used in audience

    audienceTrackingEditable boolean

    This flag shows if audienceTracking can be enabled/disabled. In some cases, audienceTracking can't be disabled. E.g. a segment has predictive conditions, such segments are tracked by default.

    conditionsData

    object

    required

    Conditions by which visitors will be segmented

    firstLevel

    object[]

    First level conditions. Every level can have many conditions inside. E.g. we have 'firstLevelOrOperators' = [true], 'firstLevel'=[{OrOperators:[false], conditions: [SKY_STATUS, DAY_NIGHT]}, {OrOperators:[true], conditions: [PAGE_TITLE, NEW_VISITORS]}]. Then the expression will look like (SKY_STATUS AND DAY_NIGHT) OR (PAGE_TITLE OR NEW_VISITORS)

  • Array [

  • conditions

    object[]

    Add conditions (see TargetingConditionIO) to define a segment. The more conditions you add, the more precise your segment will be.

  • Array [

  • oneOf

    Includes or excludes visitors according to the time elapsed since the beginning of the session

    htmlDescription string

    Html readable description of the targeting condition

    id int64

    Unique identifier

    targetingType stringrequired

    Targeting condition type. According to this field it's necessary to add some additional fields

    Possible values: [PAGE_URL, PAGE_TITLE, LANDING_PAGE, ORIGIN, ORIGIN_TYPE, REFERRERS, NEW_VISITORS, BROWSER_LANGUAGE, GEOLOCATION, DEVICE_TYPE, SCREEN_DIMENSION, VISITOR_IP, AD_BLOCKER, PREVIOUS_PAGE, KEY_PAGES, PAGE_VIEWS, FIRST_VISIT, LAST_VISIT, ACTIVE_SESSION, TIME_SINCE_PAGE_LOAD, SAME_DAY_VISITS, VISITS, VISITS_BY_PAGE, INTERNAL_SEARCH_KEYWORDS, TABS_ON_SITE, HEAT_SLICE, SKY_STATUS, TEMPERATURE, DAY_NIGHT, FORECAST_SKY_STATUS, FORECAST_TEMPERATURE, DAY_OF_WEEK, TIME_RANGE, HOUR_MINUTE_RANGE, JS_CODE, COOKIE, EVENT, EXPLICIT_TRIGGER, BROWSER, OPERATING_SYSTEM, DOM_ELEMENT, MOUSE_OUT, TARGET_EXPERIMENT, TARGET_PERSONALIZATION, EXCLUSIVE_EXPERIMENT, CONVERSIONS, CUSTOM_DATUM, YSANCE_SEGMENT, YSANCE_ATTRIBUT, TEALIUM_BADGE, TEALIUM_AUDIENCE, PRICE_OF_DISPLAYED_PAGE, NUMBER_OF_VISITED_PAGES, VISITED_PAGES, SEGMENT, KEY_MOMENT, CUSTOM, SDK_LANGUAGE, VISITOR_CODE, EXCLUSIVE_FEATURE_FLAG, TARGET_FEATURE_FLAG, APPLICATION_VERSION]

    weight int32required

    More important conditions have greater values. Default value: 1

    Example: 1
    count int32

    Count of time elapsed since session became active according to the 'unitOfTime' field

    include boolean

    Should visitors who match to the condition be included to or excluded from the segment. Default value: 'true'

    matchType string

    How to match the specified amount of time

    Possible values: [EQUAL, LOWER, GREATER]

    unitOfTime string

    What unit of measurements will be used to define if sessions are active for the required duration

    Possible values: [SECOND, MINUTE, HOUR, DAY]

  • ]

  • orOperators boolean[]

    Array of booleans ("or"=true, "and"=false) for binding conditions of second level.

  • ]

  • firstLevelOrOperators boolean[]

    Array of booleans ("or"=true, "and"=false) for binding firstLevel outer conditions.

    createdBy int64

    Account id to whom created this segment

    dateCreated date-time
    dateModified date-time
    description string

    Description of segment

    Example: The segment is for new ab tests
    experimentAmount int64

    Number of experiments using this segment. This is an optional field needs to specify in request params.

    experiments int64[]

    List of experiment ids using this segment. This is an optional field needs to specify in request params.

    featureFlagAmount int64

    Number of feature flags using this goal. This is an optional field needs to specify in request params.

    hasSegmentCondition boolean

    Indicates whether the segment has condition SEGMENT

    id int64

    Unique identifier of segment

    isFavorite boolean

    Indicates whether the segment is considered as favorite.

    name stringrequired

    Name of segment

    Example: My segment
    personalizationAmount int64

    Number of personalizations using this segment. This is an optional field needs to specify in request params.

    personalizations int64[]

    List of personalization ids using this segment. This is an optional field needs to specify in request params.

    segmentType stringrequired

    Segment type refers to the classification of segments based on their usage.

    Possible values: [STANDARD, KEY_MOMENT, FEATURE_FLAG, ALL]

    siteId int64required

    Unique identifier of site for which the segment is going to be or was created

    Example: 8372
    tags string[]
    usedBySegmentCondition boolean

    Indicates whether the segment used by condition SEGMENT in other segments

Loading...