invantive documentation
Invantive Support ForumsLog In / Sign Up

Segments: Matomo Matomo Segment Editor Segments

insert update delete REST

  • Catalog: Matomo
  • Schema: SegmentEditor
  • Primary Keys: idsegment
  • Label: Matomo Segment Editor Segments

Can retrieve data and change data using insert, update and delete.

Summary

A saved visitor filter, reusable across every reporting table's own segment parameter (out of this table's own scope - not yet wired to a segment argument on VisitsSummary.VisitsSummaries or its siblings).

API Source

  • Endpoint: /index.php?module=API&method=SegmentEditor.getAll&format=json

Performance Characteristics

Characteristic Value
Write rows per minute 1,830

The result can be cached on the client.

Table Columns

The columns of the table Segments are shown below. Each column has an SQL data type. A new non-null value must be provided for every required column at all times during insert and update.

Name Data Type Label Required Marks Documentation
auto_archive int32 itgen_mat_auto_archive filters on the platform, writable 1 if reports for this segment are pre-archived rather than computed on demand, 0 otherwise.
definition varchar2 itgen_mat_definition filters on the platform, writable The filter itself, in Matomo's own segment expression language, for instance 'visitCount>0;visitorType==new' (';' is AND, ',' is OR). Verified 2026-08-28 to round-trip unchanged through this column as plain text - Matomo escapes its own reserved characters ('#'/'''/'&') on the way in and reverses it on the way out, no JSON-level handling needed here.
deleted int32 itgen_mat_deleted filters on the platform, writable 1 if the segment is soft-deleted, 0 otherwise. Read-only - see the remark on delete() above; this table's own SELECT never actually answers a row with this column set to 1.
enable_all_users int32 itgen_mat_enable_all_users filters on the platform, writable 1 if every user may see and use this segment, 0 if it is private to the account named in the login column. Setting this to 1 requires superuser access - Matomo's own checkEnabledAllUsers() rule, verified 2026-08-28.
enable_only_idsite int32 itgen_mat_enable_only_idsite filters on the platform, writable The one site this segment is scoped to, or 0 for a segment visible across every site. Creating or updating an all-sites segment (0, or the column left unset) requires superuser access - Matomo's own checkIdSite() rule, verified 2026-08-28.
hash varchar2 itgen_mat_hash filters on the platform, writable Matomo's own hash of the segment definition, used internally to key its archive cache. Read-only.
idsegment int32 itgen_mat_idsegment filters on the platform, writable Segment ID: primary key. Matomo's own getAll()/get() answer it as 'idsegment'; update/delete take it as 'idSegment' instead, hence the explicit updatePath. Assigned by Matomo on insert, never written.
login varchar2 itgen_mat_login filters on the platform, writable Account which owns the segment. Read-only: neither add() nor update() takes a login argument - a segment is always created under the connected account.
name varchar2 itgen_mat_name filters on the platform, writable Segment name.
starred int32 itgen_mat_starred filters on the platform, writable 1 if the segment is starred (pinned) by its owner, 0 otherwise. Read-only: starring goes through the separate star()/unstar() calls, which this driver does not yet wire up.
starred_by varchar2 itgen_mat_starred_by filters on the platform, writable Login of the account which starred the segment, or null if it is not starred. Read-only, same reason as starred.
ts_created varchar2 itgen_mat_ts_created filters on the platform, writable Date and time the segment was created, as returned by Matomo. Matomo does not document which time zone this is expressed in. Read-only.
ts_last_edit varchar2 itgen_mat_ts_last_edit filters on the platform, writable Date and time the segment was last changed, as returned by Matomo, or null if it never has been. Matomo does not document which time zone this is expressed in. Read-only.