Segments allow you to filter your analytics data to analyse specific groups of visitors, behaviours, or traffic sources. This helps you focus on the data that is most relevant to your analysis.

When you create a Segment in Matomo Cloud, reports use raw data from the last 13 months by default. On-Premise users can manage data reprocessing by adjusting the configuration file.

You can manage and create segments from the Visitors > Segments page, or the Segment editor in the dashboard.

Use the Segments page

Matomo provides a central place that makes it easier to view, organise, and update your segments. Managing segments from the segment selector can be limiting, especially when working with multiple segments.

The Segments page provides a clearer overview and simplifies common tasks such as editing or cleaning up unused segments. Available in Matomo Cloud and coming soon to On-Premise.

  1. In Matomo, open Visitors > Segments.
  2. The Segments page allows you to view all available segments.
    new segment page
  3. Open and review segment definitions, edit existing segments, and delete segments you created.
  4. You can use the star icon to mark frequently used segments as favourites. This places the segment at the top of the list, so it is quicker to access.
  5. Click Add New Segment to load the Segment editor.

Use the Segment Editor

  1. To create a new Segment from the Matomo dashboard, click on the All Visits data selector.
  2. A drop-down menu will appear showing the the list of available Segments, including any custom segments shared with you or that you created.
  3. Click Add New Segment to load the Segment editor.

2. Segment Configuration

The Segment configuration settings are shown at the top of the Segment editor. Available settings will differ between Matomo Cloud and On-Premise. You can edit each setting by clicking the green drop-down arrow to its right.

segment editor settings

Sharing a segment with all users

By default, any segment created by a user is only viewable by the user who created it, as well as by all Super Users. When creating a segment, at the top of the Segment Editor it says by default “This segment is visible to me”. You can choose to share the segment with “All Users” by selecting “This segment is visible to all users”. A segment shared with all users will appear in the list of segments for all users when they view their Matomo reports. Note: sharing a segment with all users is only accessible to Super Users.

Reusing segments across other websites

By default, a segment is created on a specific website (the current website you are viewing). When editing the segment, at the top of the segment editor it says “This segment is processed for this website only”. You can choose to share the segment across all websites by selecting “This segment is processed across all websites”. When you share a segment across all websites, the segment will appear in the list of segments on all websites. Note: sharing a segment with all users is only accessible to Super Users.

Improve the performance of your site while using Segments.

Last but not least, you will see an option to decide whether segments are processed in real-time or pre-processed (which requires a cron job). The latter option will only be present if you are using a self-hosted version of Matomo as it requires server access. This feature is especially useful if your site has a lot of traffic as the default “real-time” option may lead to slow loading reports.

3. Defining your Segment

Next, you can begin creating the segment definition itself using the editor shown below. Begin by adding a clear and descriptive Name that you will use to identify your segment. For example, Customers or Returning Visitors as shown below.

Returning Visitor Segment

To define exactly what group of visitors will appear within the segment, you will need to build a filter based on elements of your collected user and visit data. You can even combine more than one filter with a logical OR / AND flow.

You can review the available criteria that can be used to define a segment by clicking on the initial dropdown field on the first row. You can identify this field as it will state Actions in Visit by default, however, clicking it will bring up the following list in a box.

Segment Filters

There are too many options available to cover in this article, so you should spend some time exploring the list of segment filters to discover them all. If you already know exactly what you want to filter by, you can use the search box to find the relevant user or visit data. You can also see a list of all segment filters available here.

Once you’ve selected a dimension to segment, for example; Visit Location > Country or Visitors > Visit type, you need to set the filtering criteria. You may notice a small question mark next to many of the filtering criteria. Hovering over these icons will display a full description of the relevant matching criteria.

Segment Filter Details

As an example, if you wanted to create a Returning Visitors from UK segment. First you’d set the first dropdown to Visit type, the second to Is and the final text box to returning. Next, you would click + Add AND condition to combine filtering options.

Within the new section; select Visit Location > Country for the first dropdown, then Is for the second and finally United Kingdom in the text box as shown below.

How To Create A Segment

When you begin typing a value in one of the text boxes for the filtering criteria, Matomo will suggest available options from the data set. You can click on these suggestions where possible to ensure the correct formatting and avoid potential typos.

After you have finished building your filter criteria, you can press the TEST button to bring up a log of all visits matching your Segment. If the details look correct, you can close the visits log popup and hit the green Save & Apply button at the bottom of the Segment editor.

Processing new Segments

  • When a segment is created in Matomo Cloud, the oldest raw data which will be incorporated is the data from 13 months ago.
  • When a segment is created in Matomo On Premise, there will be no limit to the time range; all of your raw data will be referenced for the segment. Changing this can be accomplished with the configuration file.
  1. By default, the relevant line in your global config file (config/global.ini.php) will be set as follows:
    process_new_segments_from = “beginning_of_time”.
  2. To change this, open config/config.ini.php in an editor. You may need to create this file if it does not exist already.
  3. Add this line if it is not present already:
    [General]
  4. Follow instructions from the file config/global.ini.php, for how to edit the property process_new_segments_from.

More instructions on how to edit Matomo configurations are in Include & Customise Matomo for your Project and also in the comments within the global.ini.php file itself.