Build charts in Amplitude: Modify a user segment
The segment you created in the Add user segments article is functional. Depending on the breadth of your analysis, it may be all you need. But many Amplitude users prefer to drill down further and create user segments based on specific combinations of properties. The Segmentation Module gives you the tools to define user segments with a high level of precision.
Add a filter
When you add properties to a segment definition, remember that you're specifying the property values at the time of each event.
For example, imagine you add the filter where City = Amsterdam to your segment. If a user triggers an event where City = Amsterdam, but more recently triggered an event where Country = United Kingdom, Amplitude includes only the event that matches your filter in the chart. To query an event based on a user property, set the user property before the user logs that event.
If you segment by Device ID, Event ID, Latitude, Longitude, Server Upload Time, Session ID, User ID, or ID, specify the exact values you're looking for. You can't group by the user properties Event ID, Latitude, Longitude, Server Upload Time, or ID.
To apply a filter to your user segment, follow these steps:
- Click + Filter by under your user segment. Don't click + Filter by underneath your event.
- In the Select property... menu, select the user property or behavioral cohort you want to add to the filter.
- Select the value of the user property you want to include (or specifically exclude).
- Select the operator that defines how the filter uses this property:
is,is not,contains,does not contain,less/greater than (or equal to),set is,set is not,set contains,set does not contain, andglob match.
If you enter more than one property value, the operator acts as an OR statement. To create an AND statement, add another Filter by clause.
isoris not: Include or exclude exact property values in your segment definition.containsordoes not contain: Include or exclude property values with a specific substring in your segment definition. This operator isn't case sensitive.starts withordoes not start with: Include or exclude property values with a specific prefix string in your segment definition. This operator isn't case sensitive.set isorset is not: Include or exclude specific array sets.For example, define a segment that includes users with an array set of
MoviesandMusicasInterests {=} Movies, Music.This means the user's array set must exactly includeMoviesandMusic. If the user only hasMovies, they don't meet the definition. Likewise, if the user hasSports,Movies, andMusic, they don't meet the definition.set containsorset does not contain: These operators match list values that contain all the selected values, or list values that don't contain all the selected values, respectively. Use these operators to view people who belong to multiple A/B test groups.- To exclude certain values from a property array, use
set does not contain. - If you select multiple values, these operators apply an
ANDstatement to the values. For example, with the conditionset does not contain group A and group B, a user must be NOT in group A AND group B to qualify for exclusion. To apply an OR statement, use multipleset does not containfilters.
- To exclude certain values from a property array, use
glob matchorglob does not match: Amplitude has a simple version of regular expressions that lets you match or exclude strings like/org/*/chart/*where*is a wildcard. You can also enter strings like*[0-9]or[!a-z]*to match values that end in a digit or start with a non-letter. For more information, refer to the Wikipedia article on Glob.- The asterisk only matches non-
/characters. To search for strings that contain/, use two asterisks instead. For example, if your URL format iswww.example.com/blogs/blog_id, and you want to filter all URLs that contain the word "blog," use glob match and enter**blog**.
- The asterisk only matches non-
For more information, refer to how array operators work in Amplitude.
To change the name of your segment, hover over its current name and click it. This also changes the segment's name in any charts that already use it.
Using an OR clause
To filter on multiple values of the same property, add more values in the Select value(s)... box. This creates an OR clause in the segment's definition. In the screenshot below, the segment now includes users who fired an event in the United States OR the United Kingdom OR Japan.
This doesn't apply when you set your operator to set is or set is not.
Using an AND clause
Adding another filter creates an AND clause in your segment definition. To add more filters, click + Filter by.
Was this helpful?