Filter Page URLs by Segments

Before the Matomo Update v3.12 it was possible to filter Page URLs by segments,
e.g. page.url contains /test/filer/url,
for reports or the Behaviour/Pages-View.

Since 3.12 it doesn’t work anymore. The only way to filter by url is the search function, which isn’t applicable for email reports.
Is this a bug or a wanted behaviour? Is there a solution to use this function the usual way?

Thanks for your input.

Hi Thomas

we changed how segments work in 3.12.0, now when you select visits based on a page url, it will return all visits and all page urls these visits did. So in the pages report you will now see all pages that the users also viewed as well as the pages that match the segment. (before it was only showing that page that matched the segment, which was incorrect because segments is supposed to match visits)

To do what you want I recommend you create a goal for each of the important pages/segments: Track Goals and Measure Conversions User Guide - Analytics Platform - Matomo
Then you can add the Goal reports to your emails. This should work nicely hopefully?

This change renders Piwik completely useless to us. Its really hard to understand the idea behind this, so we first though that this must be a bug.

Nobody in the right mind would ever expect this behaviour inside a filter because this is not how filters work. If a filter says “all urls that start with x”, nobody expects that this will generate something which contains other urls, its crazy!

1 Like

Why does it render Matomo useless, can you explain more what you’re trying to achieve? there is probably a different way to do it (for example, create a goal: Track Goals and Measure Conversions User Guide - Analytics Platform - Matomo )

Hallo,

the problem is that we use Matomo to track various parts of a big website and split the results into smaller pieces for our customers. Lets say we have ‘https://www.example.com’ and within this url, there are subspaces like ‘https://www.example.com/forum’ or ‘https://www.example.com/news’ or ‘https://www.example.com/whatever’.

We have about 150+ Segments who all look something like “url starts with https://www.example.com/forum” so the specific group who administers this area of the page get statistics about everything with ‘https://www.example.com/forum’ and below.

Now those results contain various other urls, and that is not what is defined within the filter. The filter says very explicit, only to accumulate things which start with https://www.example.com/forum and nothing else. So from our point of view, the filter is now broken, all results are useless. Its not a new feature, those other urls simply do not belong in this results.

Just to chime in: we faced the same in believing it was a bug.

Multiple clients using the updated matomo are explicitly not happy with the change, a few even insist we downgrade to previous version until this new behavior becomes optional (which we hope it will?)

Same issue here, we thought it was a bug and clients where really confused since existing dashboards and reports where affected. Nothing was mentioned in the release notes either from what I can understand.

However I do think it is a great feature, but I would actually suggest we add both variants.
We need both action and session based segments, that would be a great improvement to Matomo!

Hello!

We have the same issue.
That’s a huge problem for us. We have the same problem as Khabaal. Our customer can not understand it.
We have over 200 segments that do not work anymore! Our customers expect these reports every week and now … ??

@matthieu Defining goals is no solution for us. Can you think about undoing this?

Regards
Pete

1 Like

Thanks all for the feedback. We understand it’s not expected to change this behavior. From our perspective it was a bug we long wanted to fix, as most people expected the current/new behavior. The reason we did it before Matomo 4.0.0 release is because it can greatly improve archiving performance in some cases. It was mentioned in the changelog quickly, here is the original issue: https://github.com/matomo-org/matomo/issues/11900

Thats not really a good solution, at least for us.

It would mean to change Dimensions on the site again, whenever something would change in the wanted URL filtering; they wont be able to be created on the fly, like segments did. Plus, needing to put something on the website‘s tracking code instead of filtering gathered daza and not be able to use historic data is not a good alternative.

Wait: If I read that right [never worked with dimensions], could we add a dimension called „url“, then put the pages canonical url in there, and then create segments not based on the url but the Dimension „url“, and then get custom segmentation in the reports back, without needing to set distinct specific dimension in the website? We‘d still lose historical data, but at least it would be a way forward. Still, we got an installation with 300gb data, correcting that for proper historical data will be a major effort, also modifying all existing 400 segments…

(We use matomo for a large german city, and the installation covers multiple satellite sites, many backend users with custom segments for their resorts)

Hello Matthieu,

the issue you are referring describes a mistake when using the parameter “page URL”. We used the parameter “action URL” and that does not work anymore. Was that the intention too?

Where is the difference between page and action URL now?

Regards
Pete

I’m representing one of those that see this new segment behavior as a defect. We are using segments for purposes that can be anything between exclude “internal users”, include “Only mobile devices”, include “Server Time 00:00-07:00” and so on. And of course, we have many segments that just include a pattern of URL’s that will narrow the scope of reports to only include a part of the website.

In the way we were using URL based segmentations pre 3.12.0 we created subset of data for our entire site. (Similar to Views in Google Analytics). All those segments are now useless after update to 3.12.0
However, I can see a need for segmentation to be session based but also a great value in being able to do versions that are event based, especially page URL’s.

In fact some variables that can’t change during a visit will always be session based. Like Device Type, Traffic Source, Geo data, Entry Page etc.
Would it be possible to have a configuration for each segment that could be set to either:
Events - Returns all events that match the criteria (With event I mean any page view, downloads, event, actions etc)
Sessions - Identify the sessions that match the criteria, and return all the events in those sessions.

I’m really looking forward to a solution or worksaround to be able to do URL event-based segmentation again.

2 Likes

sorry about the confusion, but actually my previously written solution using custom dimension does not work :expressionless: Currently it’s not possible to segment only a set of actions and exclude other non matching actions from the reporting. Segments now filter out visits. We’d have to build a new feature or option in the future.

In the way we were using URL based segmentations pre 3.12.0 we created subset of data for our entire site. (Similar to Views in Google Analytics). All those segments are now useless after update to 3.12.0
However, I can see a need for segmentation to be session based but also a great value in being able to do versions that are event based, especially page URL’s.

In fact some variables that can’t change during a visit will always be session based. Like Device Type, Traffic Source, Geo data, Entry Page etc.
Would it be possible to have a configuration for each segment that could be set to either:
Events - Returns all events that match the criteria (With event I mean any page view, downloads, event, actions etc)
Sessions - Identify the sessions that match the criteria, and return all the events in those sessions.

I’m really looking forward to a solution or worksaround to be able to do URL event-based segmentation again.

Could you create this feature request on Github? We could add it in the future.

Thanks,

Thanks for acknowledging.

Wanted to make that request and already found it:

Also: Feature: Allow Segments to be applied not to session, but directly as the query states · Issue #15133 · matomo-org/matomo · GitHub

What you probably want to use is maybe the label filter in the API see Reporting API Reference: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3 or you can search within the data table in the UI.

If you have Custom Reports then you can use this plugin to create such a report as it allows to define “segment filters”. Then the custom report will only show these pages that match the filter.

Not recommended: You could for now probably also disable this new behaviour using a config setting in config/config.ini.php:

[General]
enable_segments_cache = 0

But we don’t recommend this and it will be removed in Matomo 4 where you would have the same problem again. There may be also other issues with disabling this setting but it should work.

Source: Segment with pageURLs + language is not working · Issue #15130 · matomo-org/matomo · GitHub