It would be valuable to be able to create segments made of other segments. The idea is that when creating a segment, there would be a new set of segments which would let you reuse any other existing segment.
For example you could have a segment
Contacted us and create another segment
Contacted us (Newsletter) which would say "Campaign Source is
newsletter AND Visit match segment
Contacted us'. So you can reuse another segment and not duplicate the logic. And it is now possible to select "Visit match segment XYZ" for any existing segment.
Why is it valuable?
There are use cases where it's not possible to create one segment that matches all conditions we need.
- For example to define a segment where a visitor IP is within a set of IP ranges. See faq https://matomo.org/faq/how-to/faq_21018/ - one can write visitIp>=188.8.131.52 AND visitIp<=184.108.40.206 but you can't write multiple such statements separated by OR combination, because the OR takes precedence (see https://developer.matomo.org/api-reference/reporting-api-segmentation#combine-segments-with-and-and-or-expressions ). It's simply impossible currently to create a segment like this and combine multiple conditions. But it would be great to be able to create a segment "Visit match segment RangeX OR Visit match segment RangeY OR Visit match segment RangeZ".
- There are several various use cases around reusing segments and minimising duplication of segment definitions across multiple segments. For example: Let's say you have an existing segments isolating a sub folder of your site ("Page URL contains /sub-folder/) and another existing one to only see 404s and 500s (Custom dimension Page code is 400 or Custom dimension page code is 500), could you apply both at the same time instead of creating a new one that has both sets of conditions?