Edit in GitHubLog an issue

Segment definition data structure

The segment definition data structure is used to communicate segment rules to the API. This data structure defines the raw logic that is used to isolate the segment data. The segment definition is a hierarchical data structure of containers, functions, and boolean logic that is used to define the segment. The segment tool in the Adobe Analytics UI follows these rules and can be a useful tool for understanding how the data structure looks.

Terms#

The following terms are used in segment definitions:

  • Schema: A report suite's configuration. Identifies which dimensions and metrics are available for use within the segment. It defines the configuration for the enabled eVars, props, events, etc.
  • Attribute: An entity in the schema. For example, variables/page or variables/evar1.
  • Context: The level that the segment logic operates on. Valid values are visitors, visits, and hits. See Segment containers in the Analytics Components guide for more information.
  • Row: A single record of data in a segment. Depending on the context, this can either be a record containing a visitor (contains all hits in all visits for a visitor), a single visit (contains all hits in a visit), or a single hit. The information stored in a row depends on the context setting for the container. For example, if the context is set to visitor, the row in the container contains all information about the visitor spanning all hits from all visits. To contrast, if the context is set to hits, the row only contains information related to the individual qualifying hits in the segment logic.
  • Container: A collection of rows. It groups the segment logic and context together for use in calculating the rows that are assigned to the container. A container has three properties: func, context,and pred.
  • Container Set: Groups containers and creates cartesian relationships between them using boolean expressions. For example, you have a container that groups visitors that have a purchase, and a second container that groups visitors who came to the website through a specific banner ad. The container set links these two containers with a boolean expression. If you use an AND condition, the visitor must match both expressions. If you use an OR condition, the visitor can match one or the other.
  • Data Set: The collection of all records used across containers and container sets to calculate the population of the segment.

Schema Functions#

Attribute functions#

FunctionDescriptionParameters
attrReferences an attribute in the schema. For example, evar1.name contains the name of the attribute in the schema.

Event functions#

FunctionDescriptionParameters
eventReferences an event from the schema. For example, event1 or revenue. To use this, an aggregation function like 'total' must also be used.name contains the name of the attribute in the schema.
totalSums an event across the context resulting in a value that can be used in comparisons.evt contains the event to be summed.
event-existsChecks for the existence of the event in the context.evt contains the event to be checked.
not-event-existsChecks for the lack of the event in the context.evt contains the event to be checked.

Grouping functions#

FunctionDescriptionParameters
segmentHolds the definition of the segment. It is the top level object.version contains an array of three numbers that describes the version to use. container is a child function that contains the definition of the segment.
containerIdentifies the context and defines segment logic.context Contains the context. Valid values are visitors, visits, hits. pred Contains the logic for this container.
andGroups multiple container objects together.preds Contains an array of containers that define the segment logic and performs a boolean AND operation on them.
orGroups multiple container objects together.preds Contains an array of containers that define the segment logic and performs a boolean OR operation on them.
withoutPerforms a boolean NOT on the container provided in the pred parameter.pred The container to perform a NOT operation on.
sequenceA group of conditions that must occur in the provided order.stream A list of ordered containers that define conditions for the segment.
sequence-prefixA list of conditions that must occur before a certain event.stream A list of container objects defining the logic for this part of the segment. context
sequence-suffixA list of conditions that must occur after a certain event.stream A list of container objects defining the logic for this part of the segment. context
sequence-andA group of unordered conditions that must all occur.checkpoints A list of container objects that define the conditions.
sequence-orA group of unordered conditions. Any individual condition (or more) must occur.checkpoints A list of containers that define conditions for the segment.

Available Data Comparison Functions#

String functions#

FunctionDescriptionParameters
streqEqualsval contains a reference to the schema. str contains a literal value.
not-streqNot Equalsval contains a reference to the schema. str contains a literal value.
strltLess Thanval contains a reference to the schema. str contains a literal value.
strgtGreater Thanval contains a reference to the schema. str contains a literal value.
strleLess Than or Equalsval contains a reference to the schema. str contains a literal value.
strgeGreater Than or Equalsval contains a reference to the schema. str contains a literal value.
streq-inMatch a string to any of the values in the parameterval contains a reference to the schema. list contains an array of literal values.
not-streq-inEnsure a string doesn't match any of the values in the parameterval contains a reference to the schema. list contains an array of literal values.
containsEnsure a string matches or contains the value in the parameterval contains a reference to the schema. str contains a literal value.
not-containsEnsure a string doesn't match or contains the value in the parameterval contains a reference to the schema. str contains a literal value.
contains-any-ofEnsure a string contains any of the values in the parameter. Case-insensitive.val contains a reference to the schema. list contains an array of literal values.
contains-all-ofEnsure a string contains all of the values in the parameter. Case-insensitive.val contains a reference to the schema. list contains an array of literal values.
not-contains-any-ofEnsure a string doesn't contain at least one of the values in the parameter. Case-insensitive.val contains a reference to the schema. list contains an array of literal values.
not-contains-all-ofEnsure a string doesn't contain any of the values in the parameter. Case-insensitive.val contains a reference to the schema. list contains an array of literal values.
starts-withEnsure a string starts with the value in the parameter. Case-insensitive.val contains a reference to the schema. str contains a literal value.
ends-withEnsure a string ends with the value in the parameter. Case-insensitive.val contains a reference to the schema. str contains a literal value.
not-starts-withEnsure a string doesn't start with the value in the parameter. Case-insensitive.val contains a reference to the schema. str contains a literal value.
not-ends-withEnsure a string doesn't end with the value in the parameter. Case-insensitive.val contains a reference to the schema. str contains a literal value.
matchesEnsure a string matches the glob parameter. A glob parameter uses a '' character to match any sequence of characters. A literal '' is expressed with '*'.val contains a reference to the schema. glob contains a literal value.
not-matchesEnsure a string doesn't match the glob parameter. A glob parameter uses a '' character to match any sequence of characters. A literal '' is expressed with '*'.val contains a reference to the schema. glob contains a literal value.

Numeric functions#

FunctionDescriptionParameters
eqEqualsval The attribute to compare. num The literal number being compared to.
not-eqNot equalsval The attribute to compare. num The literal number being compared to.
gtGreater thanval The attribute to compare. num The literal number being compared to.
ltLess thanval The attribute to compare. num The literal number being compared to.
geGreater than or equal toval The attribute to compare. num The literal number being compared to.
leLess thanval The attribute to compare. num The literal number being compared to.
eq-any-ofEqual to any of the values providedval The attribute to compare. list An array of numbers to use in the comparison.
not-eq-any-ofNot equal to any of the values providedval The attribute to compare. list An array of numbers to use in the comparison.

Existence functions#

FunctionDescriptionParameters
existsTests if an attribute has been set to a value.val The attribute to test.
not-existsTests if an attribute has never been set to a value.val The attribute to test.

Temporal functions#

FunctionDescriptionParameters
ime-restrictionUsed to determine if a checkpoint occurred within a given time frame.limit Limits the event to a context. Valid values are after or within. unit A unit of time. Valid values are minute, hour, day, week, month, quarter, year. count The number of temporal units based on the unit parameter.
container-restrictionUsed to determine if checkpoints described in other containers have happened in a specific sequence.limit Limits the event to a context. Valid values are after or within. count Specifies the number of events (page views, visits, days, months, etc) between two checkpoints.
dimension-restrictionUsed between checkpoints to specify the activity can exist in sequence between them.limit Limits the checkpoint to a context. Valid values are after or within. count Specifies the number of events (page views, visits, days, months, etc) between two checkpoints.
exclude-next-checkpointEnsures the next checkpoint doesn't happen between the preceding checkpoint and the subsequent checkpoint. If there is no subsequent checkpoint then the excluded checkpoint must not occur at any point after the preceding checkpoint. If there is no preceding checkpoint then the excluded checkpoint must not have occurred at any point preceding the subsequent checkpoint.

See Build sequential segments in the Analytics Components user guide for more information.

  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.