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

For suggested segment values for userId segment use archive when possible #15823

Closed
tsteur opened this issue Apr 17, 2020 · 0 comments · Fixed by #15824
Closed

For suggested segment values for userId segment use archive when possible #15823

tsteur opened this issue Apr 17, 2020 · 0 comments · Fixed by #15824
Assignees
Labels
c: Performance For when we could improve the performance / speed of Matomo. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Milestone

Comments

@tsteur
Copy link
Member

tsteur commented Apr 17, 2020

Follow up from #15786

We noticed in some cases this can run for many hours otherwise eg if the user is actually not using the userId feature

Tested

diff --git a/plugins/CoreHome/Columns/UserId.php b/plugins/CoreHome/Columns/UserId.php
index cf5b16db99..0c3a37b36b 100644
--- a/plugins/CoreHome/Columns/UserId.php
+++ b/plugins/CoreHome/Columns/UserId.php
@@ -12,6 +12,7 @@ use Piwik\Cache;
 use Piwik\DataTable;
 use Piwik\DataTable\Map;
 use Piwik\Metrics;
+use Piwik\Plugin;
 use Piwik\Plugin\Dimension\VisitDimension;
 use Piwik\Plugins\VisitsSummary\API as VisitsSummaryApi;
 use Piwik\Tracker\Request;
@@ -39,6 +40,13 @@ class UserId extends VisitDimension
      */
     protected $columnType = 'VARCHAR(200) NULL';
 
+    public function __construct()
+    {
+        if (Plugin\Manager::getInstance()->isPluginActivated('UserId')) {
+            $this->suggestedValuesApi = 'UserId.getUsers';
+        }
+    }
+
     /**
      * @param Request $request
      * @param Visitor $visitor

but this alone does not yet do the job. We also need change the getUserId API method also needs to add the segment metadata to each row so it can be used in the suggestedValuesAPI. It should add row segment metadata like userId==$theLabel

@tsteur tsteur added the c: Performance For when we could improve the performance / speed of Matomo. label Apr 17, 2020
@tsteur tsteur added this to the 3.13.6 milestone Apr 17, 2020
@tsteur tsteur self-assigned this Apr 17, 2020
@tsteur tsteur modified the milestones: 3.13.6, 3.13.5 Apr 17, 2020
@sgiehl sgiehl linked a pull request Apr 17, 2020 that will close this issue
@sgiehl sgiehl closed this as completed Apr 17, 2020
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Performance For when we could improve the performance / speed of Matomo. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants