Advanced Segment Builder
Build OTQL queries visually from your schema, with AND / OR groups and no query language to write.
What it is
The Advanced Segment Builder is a graphical interface for exploring your data and producing OTQL queries from your schema. It needs no setup, but it does assume you know your schema, which makes it the natural tool for a data-literate user building ad hoc segments.
Reach it from the side menu: Audience > Builders > Advanced segment builder. Its query editor lets you define a segment's criteria visually, without writing code. It opens when you create a segment, or when you click Edit Query on an existing one.
The query editor
The screen is made up of these areas.
The summary bar
At the top left, the summary bar shows the object the query runs on, usually UserPoint. Click it to calculate the number of users matching your criteria. The count is not refreshed automatically: click it again after changing the query to see the impact of your changes.
Depending on where the editor is opened, the following actions may be available:
View matching users
Lists the users matching the query, so you can check that the segment targets the right profiles.
Show OTQL
Displays the query in its text form, OTQL, to copy, share or review it.
Open segment
Opens the segment linked to this query.
Save as segment
Saves the current query as a new segment. See Creating the segment.
The query canvas
The central area is where you build your query, as a tree. Each block represents an object of your data model, for example profiles or activity_events, and the boxes attached to it are the conditions applied to its fields, for example first_name is defined.
Blocks are connected by logical operators:
AND: all connected conditions must be met.
OR: at least one must be met.
Use the + buttons to add a condition at a given level. The zoom controls at the bottom left zoom in, zoom out or recenter the view when the query gets large.
The schema explorer
The right-hand panel lists the objects and fields available in your data model, such as accounts, activity_events, profiles or segments. Expand an object with its arrow to see its fields, or use the search bar to find a field. To add a criterion, drag an object or field onto the canvas. The > button at the top of the canvas hides or shows the panel.
The panel shows only the indexed fields of your schema. What each object holds is described in How mediarithmics works, and how the schema decides what is indexed in Schema definition.
Objects, frequency, field conditions
Start a segment by adding an Object or a Group.
An object is one audience criterion, directly linked to your schema. On it you can add:
A frequency. Tick the check box and enter the minimum number of occurrences.
Field conditions. Click Add a Field Condition to narrow the object further.
When the object's conditions are right, click Update to apply them and see the resulting query. Then click the summary bar to recalculate the user count.
Pasting many values at once
You can paste multiple values into a segment filter instead of adding them one at a time. Supported separators are a comma - except inside double quotes - and a line break.
element1, element2, element3
3 separate entries
element1
element2
element3
3 separate entries
element1, "data, with, commas", element3
3 separate entries - the quoted content stays intact
element1, element2
element3, "data, with, commas"
element5
5 separate entries
Groups
Click + and then Group to add group conditions. Groups let you include, exclude, and manage and / or relationships between blocks of audience - and let you combine several standard objects in one condition, for example Profiles AND Events.
Creating the segment
Click Save as segment, name the audience, and save it. You can optionally fill in the advanced fields: technical name, default lifetime, persisted, paused.
The new segment is immediately available in Audience > Segments.
Where else this interface appears
The If node of an automation uses this same interface to evaluate its condition, which is why the automations documentation points here rather than re-explaining it. See Flow control.
Related pages
Last updated
Was this helpful?