Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow a Segment to combine other segments with AND/OR combinations #14129

Open
mattab opened this issue Feb 22, 2019 · 6 comments
Open

Allow a Segment to combine other segments with AND/OR combinations #14129

mattab opened this issue Feb 22, 2019 · 6 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

Comments

@mattab
Copy link
Member

mattab commented Feb 22, 2019

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>=147.28.0.0 AND visitIp<=147.28.255.255 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?
@mattab mattab added the Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. label Feb 22, 2019
@mattab mattab added this to the Backlog (Help wanted) milestone Jan 21, 2020
@fredvd
Copy link

fredvd commented Jun 9, 2022

This issue is IMHO one of the examples that demonstrate a drawback of 'plugin financed' open source business models:

It's frustrating that for any organisation small or large with multiple ip ranges in their internal networks they can't create a segment that filters out that internal traffic. this issue is from 2019, it's 2022 now. This is a very valid use case and allthough I really want to promote the use of Matomo at our customers and in our community (Plone) it is gaps like these that don't get addressed in 3 years that make me doubt.

I know part of the reason why this is issue is not made a priority and/or addressed, because it is in the documention and FAQ's: please buy our commercial Custom Reports plugin that has a better and/or rules UI without this limitation.

@fredvd
Copy link

fredvd commented Jun 9, 2022

For others searching for a solution and finding this issue because they want to create a segment with multiple ip ranges to compare traffic sources or see if 'internal' traffic is significant, you can do the following:

Create a segment for each internal ip range and then in the drop down for segments there squarish (open book?) icon left of the edit icon that allows you to compare segments. You can add multiple segments to see them in one graph for for example visitors and pages views and then you can check if the traffic is significant.

segment drop down

compare multiple segments

@sgiehl
Copy link
Member

sgiehl commented Jun 9, 2022

@fredvd Even the custom reports plugin wouldn't allow you to combine multiple IP ranges into one segment, but you could create segmented reports for each ip range.

@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/new-segment-creation/47980/2

@atom-box
Copy link

Another user asked for this feature today.

o It could be good to be able to select 2 segments (I know that it would increase a lot the number of reports to be processed as it will multiply)

o Then I will be able to display easily data for one specific user category and one specific country without having to create each possible segments…

@emernual
Copy link

Matomo user looking for this feature:

Combining segments<

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

6 participants