SegmentsList
This documentation is for an outdated Matomo version.
Click here if you want to read this article for the latest version.
Click here if you want to read this article for the latest version.
Piwik\Segment\
SegmentsList
Manages the global list of segments that can be used.
Segments are added automatically by dimensions as well as through the Segment.addSegments event. Observers for this event should call the addSegment() method to add segments or use any of the other methods to remove segments.
Methods
The class defines the following methods:
addSegment()getSegments()— Get all available segments.remove()— Removes one or more segments from the segments list.getSegment()
addSegment()
Signature
It accepts the following parameter(s):
$segment(Segment) —
It does not return anything or a mixed result.
getSegments()
Get all available segments.
Signature
- It returns a
Segment[]value.
remove()
Removes one or more segments from the segments list.
Signature
- It accepts the following parameter(s):
$segmentCategory(string) — The segment category id. Can be a translation token eg 'General_Visits' see Segment::getCategoryId().$segmentExpression(string|false) — The segment expression name to remove eg 'pageUrl'. If not supplied, all segments within that category will be removed.
- It does not return anything or a mixed result.
getSegment()
Signature
It accepts the following parameter(s):
$segmentExpression(string) — Name of the segment expression. egpageUrl
Returns:
Segment|null—