diff options
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | core/Segment/SegmentsList.php | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f3a804c20e..201cf994f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ The Product Changelog at **[matomo.org/changelog](https://matomo.org/changelog)* * The config setting `enable_default_location_provider` in `Tracker` has been added. By setting this option to 0, you can disable the default location provider. This can be used to prevent the geolocator to guess the country based on the users language, if the configured provider doesn't provide any results. +#### New PHP events + +* Added new event `Segment.filterSegments`. Plugins can use this to filter segment definitions. + ## Matomo 4.7.0 ### Deprecated APIs diff --git a/core/Segment/SegmentsList.php b/core/Segment/SegmentsList.php index 82ea86065e..448a4f1593 100644 --- a/core/Segment/SegmentsList.php +++ b/core/Segment/SegmentsList.php @@ -132,6 +132,20 @@ class SegmentsList $dimension->configureSegments($list, new DimensionSegmentFactory($dimension)); } + /** + * Triggered to filter segment definitions. + * + * **Example** + * + * public function filterSegments(&$segmentList) + * { + * $segmentList->remove('Category'); + * } + * + * @param SegmentsList $list An instance of the SegmentsList. + */ + Piwik::postEvent('Segment.filterSegments', array($list)); + $cache->save($cacheKey, $list); return $list; |