Building segments and targets

You can create segments in virtually every section of Leanplum, including in Messages, Campaigns, the UI Editor, and A/B Tests. These segments make up the Target for your test or message. You can also use segments as Filters in the Users and Analytics Dashboards to view metrics and information for a specific group of users.

Create a Segment

No matter where you are in Leanplum, the process of creating a target segment or filter is the same:

  1. Select a segment criteria. Click the All Users dropdown to show the segment options available. Choose one of the segment criteria to add it to your target phrase. 

    See Segment criteria options for a full list of segment options and examples.

  2. Choose an operator. Operators modify how each user is evaluated against your segment. Clicking on the operator inside the target phrase gives you more operator options to select from.

    For example, you could modify the segment criteria “App version” with an operator like “is greater than”, “is less than”, "is any", or “is at most” a certain number.

    Tip: Different types of segment criteria (string, datetime, number, etc.) have different operator options. See Operators Table for more details.

  3. Enter a value. Many operators require a value so that Leanplum has something to compare your users to. Click the value in the target phrase to edit it. For example, the operator “is less than” would require a number value to complete the Target phrase (e.g. "Occurrences of Add to Cart is less than 3").

    You can also add more than one value by clicking the value, then clicking the + button. Likewise, you can remove a value by clicking the button.

  4. Add additional criteria to your segment with AND/OR. Click the + button in the target phrase, then repeat the steps above to create a segment with multiple criteria. Click AND to choose either an AND or OR operator between each segment.

    • AND will target users who fit both of your selected segment requirements. For example, the target phrase “City is Los Angeles” AND “Device model is iPhone” would only include users who are in Los Angeles AND use an iPhone. 
    • OR will target users who fit in either (or both) of the segments you chose. For example, the phrase “City is Los Angeles” OR “Device model is iPhone” would send to all users in Los Angeles, regardless of their device type, and to all iPhone users, regardless of their location.

  5. Save your new segment for later use. Click the save icon if you want to save the target phrase you just created. 

See Using Saved segments for advanced targeting for more on Saved segments.

Excluding Segments From Your Target Audience

You can also create segments of your target audience to exclude them from certain campaigns. This prevents certain users from being adversely affected by a message or experience change. There are two ways to achieve this goal:

Negative Operators

You can use operators like “is not,” and “does not contain” to exclude some segments from your target audience. For example, you could set your target phrase as “Device model is not iPhone 6” to exclude iPhone 6 users from your audience. See Operators reference and examples.

Not Saved Segments

For segment options that don’t have the “is not” operator, or more complex segment options, you can use the Not saved segment feature, which targets all the users who aren’t in the Saved segment you create.

Just click Not saved segment from the All Users dropdown and choose the segment you want to exclude from the campaign, message, or test.


For more, see Saved segments.


Was this article helpful?
Have more questions? Submit a request