Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Unique visitors and Users metric shown in Users report #22670

Merged
merged 2 commits into from
Oct 14, 2024
Merged

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Oct 10, 2024

Description:

Fix #19850

Removes Users and Unique Visitors metrics from the Users report. Those metrics don't make sense considering they would be always "1" except for the others row.

I also thought about additionally removing it from the API response (see diff below) but wasn't sure if we consider this a breaking API change. Figured in the API response the output of those metrics doesn't hurt as much and we can keep it there. In the UI the unneeded metrics "hurt" more considering it's processed by humans and it causes distraction.

diff --git a/plugins/UserId/API.php b/plugins/UserId/API.php
index a213466346..13256f5666 100644
--- a/plugins/UserId/API.php
+++ b/plugins/UserId/API.php
@@ -40,6 +40,9 @@ class API extends \Piwik\Plugin\API
         $dataTable->queueFilter('ReplaceColumnNames');
         $dataTable->queueFilter('ReplaceSummaryRowLabel');
         $dataTable->queueFilter('AddSegmentByLabel', array('userId'));
+        // Removing columns queued to improve performance. We could have 100K users in the table but only
+        // display 50 of them. We only want to perform this action on the 50 users.
+        $dataTable->queueFilter('ColumnDelete', array(array('nb_users', 'nb_uniq_visitors')));
 
         return $dataTable;
     }

Steps to reproduce

Review

@michalkleiner
Copy link
Contributor

Thanks for the PR, @tsteur. It seems we don't have this covered by tests as no test newly failed. @matomo-org/core-reviewers do we think we should add one?

@sgiehl
Copy link
Member

sgiehl commented Oct 14, 2024

I've added some simple UI tests

@sgiehl sgiehl added this to the 5.2.0 milestone Oct 14, 2024
@sgiehl sgiehl added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. c: Usability For issues that let users achieve a defined goal more effectively or efficiently. labels Oct 14, 2024
@sgiehl sgiehl merged commit 55256ab into 5.x-dev Oct 14, 2024
24 of 25 checks passed
@sgiehl sgiehl deleted the m19850 branch October 14, 2024 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Usability For issues that let users achieve a defined goal more effectively or efficiently. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

in User IDs report: remove columns "Unique Visitors" and "Users"
3 participants