@Tolriq opened this Issue on April 3rd 2019

Currently testing Matomo and find it to be a wonderful project and evolution since Piwik 0.9 that I tested a very very very long time ago.

I currently have one big missing thing from Google Analytics, it's "down level" event navigation. (Sorry not native English don't know how to better describe).

Typically I'd like to be able to click on an event category then see all the actions from that category, then click on a action and see all names from that category and action.

Creating tons of manual segments are not really usable :( And I have many cases where I have identical action for different categories, so directly browsing from the event actions part is not an option either.

Do I miss something in the GUI? Or is it possible to make a feature request for that?

Edit by @tsteur : See conversation below. In https://github.com/matomo-org/matomo/issues/7215 we added an icon to the segmented visitor log, a plugin could however also add a row action to apply the segment directly without opening the segmented visitor log and without opening the edit segment screen after clicking on it.

@tsteur commented on April 3rd 2019 Member

There is likely already an issue for this but can't search right now. It can otherwise be done with https://plugins.matomo.org/CustomReports though.

@tsteur commented on April 3rd 2019 Member
@Tolriq commented on April 3rd 2019


Did not get back up to that old on the search. And can't afford 200€ per year to use a feature 1 or 2 times a month :)

And actually this is not really the same need. I don't require a change of the display to see all at one. I'd like to have automatic custom segments when navigating down.

Adding a small button near open segmented visit log, that could be a simple add to current segment. That would add
&segment=eventCategory%3D%3DYYYYYY (or the ;eventCategory%3D%3DYYYYYY if there's already an active segment)

Then when clicking on an event action same thing that add to the segment the eventAction%3D%3DXXXX.

Sounds like a simple addition that would simplify user life a lot instead of tons of manual segments handling and editing.

@tsteur commented on April 3rd 2019 Member

When you click on "open segmented visit log", there is a button add the bottom to "add it as a current segment" maybe that helps you? Not sure why it's at the bottom as it requires a lot of scrolling but might still help?

@Tolriq commented on April 3rd 2019

Wow, well hidden feature, totally missed it. Thanks.

It does help to create the tons of saved segments, but on version 3.9.1 it does propose to create a new saved segment and require a name. So you'd have to first create a new segment for category then create a new one for the action. And they'd be saved and require manual deletion if it's a temporary segment (typically those descending event segment are often applied on another dynamic segment)

Since Matomo support an active custom segment (You can enter any segment param in url and it's properly supported and displayed as custom segment) maybe that add dialog could be modified by either adding an apply button near the save & apply, or when no name is entered instead of the error dialog, propose to apply the segment without saving it?
That would solve the issue for me, even with a tons of unneeded scrolling this would still be a perfect workaround.

@tsteur commented on April 3rd 2019 Member

To keep the UI simple we will likely not add another button or selector for this or so. Also it would only work if browser archiving for segments is enabled (most people should have it activated though). It would be possible to do this in a plugin though. I can rename and reopen the issue, and add a plugin label to it. I doubt we will be working on it though any time soon.

@Tolriq commented on April 3rd 2019

This is a huge limitation for users migrating from Google Analytics and with Google analytics for apps deprecated, and Firebase so limited for events, many people could try Matomo as a replacement, you certainly have something to play here, but for apps, events are one of the most important thing.

It's been a very long time since I've done some php but as it's an important feature for me, would it require a huge plugin or would it be relatively simple to implement, like just registering a few things to add a button in the rows then just a matter of filling the custom segment?

Else I'll write a simple SQL query tool to directly fetch from DB, but all I need is already here, just missing a way to link things.

@tsteur commented on April 4th 2019 Member

I think you would mainly need a row action like this: https://github.com/matomo-org/matomo/blob/3.x-dev/plugins/Live/javascripts/rowaction.js#L14

Ideally you would also need to add a JS variable like piwik.isBrowserArchivingForSegmentsEnabled = true/false to the DOM like it is done here: https://github.com/matomo-org/matomo/blob/7b6a14626960795b0acdf4a064cd3982d7704f2b/plugins/CoreAdminHome/CoreAdminHome.php#L83-L92 as you should only show this feature when browser archiving for segments is actually enabled.

@Tolriq commented on April 5th 2019

Ok thanks will look at that next week. Long time no PHP/JS will be fun.

I'll probably ping you if I have doubts about different solutions, to know what have the more chances to be accepted for plugin distribution as I'm sure it could help others.

@Tolriq commented on April 8th 2019

@tsteur So got everything to work pretty easily, thanks for the pointers :)

I just have one issue with how to properly apply the segment change without a full reload of the page.
I searched a lot and can't find the proper way to just reload the content.

broadcast.propagateNewPage('segment='+segment, true)

Works but reload the full page so is slow and not nice UX :(

I tried propagateAjax but could not get it to work properly and it's deprecated anyway.

Looked into segmentation and found

// this code is mad, and may drive you mad.
// the whole segmentation editor needs to be rewritten in AngularJS with clean code

Since my js skills are limited I thought it was time to ask for help :)

Getting back to it later, I've went the manual way, but I'm sure there's a proper one :)

        let dummyUrl = new URL('');
        dummyUrl.search = window.location.hash.substring(2);
        dummyUrl.searchParams.set('segment', segment);
        window.location.hash = '?' + dummyUrl.searchParams;
@tsteur commented on April 8th 2019 Member

Try something like this (that's what the segment editor seems to do):

 angular.element(document).injector().invoke(function ($location, $rootScope) {
                    var $search = $location.search();

                    if (segmentDefinition !== $search.segment) {
                        // eg when using back button the date might be actually already changed in the URL and we do not
                        // want to change the URL again
                        $search.segment = segmentDefinition.replace(/%$/, '%25').replace(/%([^\d].)/g, "%25$1");
                        setTimeout(function () {
                            try {
                            } catch (e) {}
                        }, 1);
@Tolriq commented on April 9th 2019

Thanks since it's not an official function will keep my way easier to read way :)

I've pushed the plugin at https://github.com/Tolriq/Matomo-EventSegmentNavigation it works perfectly for my need, thanks again for the pointers.

Not sure this is advanced enough to warrant the trouble of going to through official release on the marketplace.

@tsteur commented on April 9th 2019 Member

Had a quick look at the code. If you wanted to make it an official release, I would recommend changing hard coded URL https://github.com/Tolriq/Matomo-EventSegmentNavigation/blob/master/javascripts/rowaction.js#L76 and making it compatible with more browsers, not just those that support let etc. Great feature though :)

@Tolriq commented on April 9th 2019

Was not sure about let my IDE told me to use them, I've revert :)

For the hardcoded url this is a dummy one not used, this allows to use native stuff to properly update the params in the url hash without regexp. I've added a comment.

To be perfect the plugin should move to the Actions when applying a category segment and stay in actions or move to names when applying an action filter, but had no time to fully research on those as it require to be applied after the page reload :(

@mattab commented on October 7th 2019 Member

@Tolriq Be great if you could publish your plugin on the Marketplace eventually, see: https://developer.matomo.org/guides/distributing-your-plugin - it's quite easy to do :+1:

@Tolriq commented on October 7th 2019

@mattab Sorry but no plan for that as it's not really usable in production with large data :( And when I officially publish things I provide support and won't be able for this.

The filters are insanely slow and timeout if not pre generated by the cron but those require to be added as static and wait for the cron.

Currently doing database SQL to get the data I need.

Powered by GitHub Issue Mirror