For JQL and Data Export API only
This article is about Segmentation Expressions for JQL or the Data Export API.
The easiest way to build segmentation expressions is by looking at the requests within the standard Mixpanel Segmentation report. Find the on/where parameters for segmentation API requests:
- Open up your Mixpanel project, click Segmentation, then chose an event and property.
- Open up the developer console (on Chrome, Ctrl + Shift + J for Windows/Linux; Cmd + Opt + J for Mac) > Network, and search for “segmentation.”
- Scroll down to Query String Parameters in the XHR request to find “on.”
- Filter your property by selecting the arrow to the right.
- Open the XHR request and scroll down to Query String Parameters to find “where.”
You can apply expressions to these where and on parameters to perform mathematical operations, logical operations, or typecasts. See additional technical documentation on writing segmentation expressions.
Examples of Selectors for Segmentation Expressions
Equals | (properties["$city"] == "Chicago")
Does not equal | (properties["$city"] != "Chicago")
Contains | ("Facebook" in properties["$referring_domain"])
Does not contain | (not "Facebook" in properties["$referring_domain"])
Set | (defined (properties["$device"]))
Not set | (not defined (properties["$device"]))
So if you wanted to create a segmentation expression where browser is Chrome and email does not contain @yourdomain.com, your where parameter would be:
(properties["$browser"] == "Chrome" and not "@yourdomain.com" in properties["$email"])