@tsteur opened this Issue on April 17th 2020 Member

Follow up from https://github.com/matomo-org/matomo/pull/15786

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


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';
+        }
+    }
      * <a class='mention' href='https://github.com/param'>@param</a> Request $request
      * <a class='mention' href='https://github.com/param'>@param</a> 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

This Issue was closed on April 17th 2020
Powered by GitHub Issue Mirror