Skip to content

Conversation

@tzi
Copy link
Contributor

@tzi tzi commented Nov 12, 2025

Description

New “Star” Feature: each segment can be "starred" by clicking on a star icon.
Starred segments are highlighted at the top of the list.

What happen when a segment star is clicked :

  • Move the segment immediately at the top of the list
  • The Star icon is filled in
  • A API called is made to store this change

Screenshots

before / after
before after
tooltips
tooltip unstarred tooltip starred
Screenshot 2025-11-18 at 18 25 24 Screenshot 2025-11-18 at 18 25 37
Animation
star unstar error
star-star star-unstar star-error

Checklist

  • [NA] I have understood, reviewed, and tested all AI outputs before use
  • [NA] All AI instructions respect security, IP, and privacy rules

Review

@tzi tzi added the Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. label Nov 12, 2025
@tzi tzi changed the title Allow to start/unstar stored segment Allow to star and unstar stored segment Nov 14, 2025
@tzi tzi force-pushed the ux-326 branch 10 times, most recently from 24a8707 to cb064c5 Compare November 17, 2025 17:41
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ The new tests changed the visible focused element on this screenshot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ The starred segment comes at the top of the list

Comment on lines +898 to +1005
self.target.find('[title]').each(function () {
addTooltip(this, this.getAttribute('title'));
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Fix tooltip for all actions in the SegmentList

Comment on lines +236 to +241
display: flex;
flex-direction: column;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Use flexbox to be able to reorder starred segment easily.

Comment on lines +255 to +261
.segmentationContainer .submenu ul li[data-idsegment=""] {
order: 0;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ First line is always "All visitors"

@tzi tzi force-pushed the ux-326 branch 2 times, most recently from d004753 to 5c02c19 Compare November 17, 2025 23:55
@tzi tzi marked this pull request as ready for review November 18, 2025 01:03
@tzi tzi added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. c: Design / UI For issues that impact Matomo's user interface or the design overall. Needs Review PRs that need a code review c: Segments Segmentation and Segment editor related improvements and fixes. and removed Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. c: Design / UI For issues that impact Matomo's user interface or the design overall. labels Nov 18, 2025
@tzi tzi requested a review from a team November 18, 2025 01:03
@tzi tzi force-pushed the ux-326 branch 2 times, most recently from 7134cf8 to 581d2c2 Compare November 25, 2025 06:54
Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments. Besides those I'm wondering if the highlight effect after staring/unstaring a segment id expected. The segment remains highlighted even after hover of other segments 🤔

Image

{
return [
$this->migration->db->addColumns('segment', [
'starred' => 'TINYINT(1) NOT NULL DEFAULT 0',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing came to my mind after reading the requirements again. If that hasn't changed again the starring should be handled by website, but currently that happens by segment. This might need some clarification.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand this comment.
I understood the requirements that we should star a segment per Matomo instance and not per user, so a starred segment is visible by every users. That’s why we added a "starred by …" label.
Do you think we should store the segment per website entity?

@tzi tzi force-pushed the ux-326 branch 2 times, most recently from 3d259c0 to 094a34f Compare November 28, 2025 16:10
@mattab
Copy link
Member

mattab commented Nov 28, 2025

UPDATED COMMENT

Here is a clarification. Considering that segments can be created across all websites by a super user, we can't let people remove them from Starred on one website which would affect other websites where this segment exists. So we need to treat these global segments differently when it comes to starring.

In addition:

  • View users can only add to Starred or remove from Starred for the segments they created themselves.
  • For any segment created by someone else, only Write, Admin, or Super Users can add/remove from Starred.
  • Only Super Users can edit segments that apply across all sites.

Below are the proposed tooltips that reflect these rules:


1. Global segment

For non super users (star icon disabled)

This is a global segment created by a super user. Only super users can edit or star global segments.

For super users (star icon enabled)

This is a global segment. Adding to Starred or removing from Starred will apply across all websites.


2. Site-specific segment

For users without permission to star (e.g. View user viewing someone else's segment)

You can only add to Starred the segments you created yourself.

For users with permission (Write/Admin/Super User, or View user starring their own segment)

Add to Starred segments for this website.

@sgiehl
Copy link
Member

sgiehl commented Nov 30, 2025

@mattab Is there a specific reason why this isn't a user specific action? Personally I think allowing every user to star the segments they need, rather than having it global or site specific might bring much more value to the customers. And storing that per user instead of together with the segment wouldn't be that much more effort - compared to implementing the special handling for global segments.

@mattab
Copy link
Member

mattab commented Nov 30, 2025

The main reason is to

  1. Keep it simple and consistent between team members and although it's limiting in some way it's also liberating to be consistent

  2. try and understand what is really important to this website so that later we can use that information to better generate Insights that are relevant to these segments. (FYI also same eventually for starred segments and starred pages then I think they should be by website. The only different one are reports which are really different for people and for that I would call it differently like pinned reports and have it per user but maybe eventually let them pin across users as well)

  3. It's less effort and I rather not change the scope now for this.

@tzi tzi force-pushed the ux-326 branch 2 times, most recently from b6209bd to dc0d932 Compare December 2, 2025 10:08
@sgiehl sgiehl removed the request for review from michalkleiner December 2, 2025 15:08
comparedSegments.indexOf(decodeURIComponent(definition)) !== -1
);
$segment.toggleClass('comparedSegment', isCompared);
$segment.find('.compareSegment').attr('data-state', isCompared ? 'active' : '');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Handle an active state on comparison segment button

Image

$(this).addClass('no-click');
$(this).parent().attr('title', _pk_translate('General_MaximumNumberOfSegmentsComparedIs', [limit]));
$compareButton.attr('data-state','disabled');
addTooltip($compareButton, _pk_translate('General_MaximumNumberOfSegmentsComparedIs', [limit]));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Add a disabled state for the compare button
ℹ️ The tooltip was on the libut it should have been on the .compareSegment button

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: Segments Segmentation and Segment editor related improvements and fixes. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Needs Review PRs that need a code review

Development

Successfully merging this pull request may close these issues.

6 participants