Split results of Customdimensions Plugin into two Folders

I want to configure the CustomDimensions-Plugin so that it sends it’s results into two different folders (EDS and Solr) based on the name of the customdimension. The CustomDimensions get sorted correctly in the two foldders but in the second folder (Solr) the Customdimension names aren’t displayed correctly. Instead of the customdimension names, their names are customdimension1, … .

I know this is a dirty workaround, but to achieve this I’ve rewritten the CustomDimension.php in the matomo-folder like this:

 if ($dimension['scope'] === CustomDimensions::SCOPE_ACTION) {
           if (strpos($dimension['name'], 'EDS') !== 0){$this->category = 'EDS';}
           elseif (strpos($dimension['name'], 'Solr')!== 0) {$this->category = 'SolR';}
            $this->dbTableName = 'log_link_visit_action';
            $this->suggestedValuesCallback = function ($idSite, $maxValuesToReturn) use ($dimension) {
                $autoSuggest = new AutoSuggest();
                return $autoSuggest->getMostUsedActionDimensionValues($dimension, $idSite, $maxValuesToReturn);
            };
        } elseif ($dimension['scope'] === CustomDimensions::SCOPE_VISIT) {
            $this->category = 'General_Visitors';
            $this->dbTableName = 'log_visit';
        }
    }

I’ve also rewritten the GetCustomDimension.php

if ($this->scopeOfDimension === CustomDimensions::SCOPE_ACTION) {
            if (strpos($dimension['name'], 'EDS')!== false ){$this->categoryId = 'EDS';}
            elseif (strpos($dimension['name'], 'Solr')!== false) {$this->categoryId = 'SolR';}
            $this->dimension = new CustomActionDimension($dimensionField, $this->name, $dimension['idcustomdimension']);
            $this->metrics = array('nb_hits', 'nb_visits');
            $this->processedMetrics = array(
                new AverageTimeOnDimension(),
                new BounceRate(),
                new ExitRate(),
                new AveragePageGenerationTime()
            );
        } elseif ($this->scopeOfDimension === CustomDimensions::SCOPE_VISIT) {
            $this->categoryId = 'General_Visitors';
            $this->dimension = new CustomVisitDimension($dimensionField, $this->name, $dimension['idcustomdimension']);
            $this->metrics = array('nb_visits', 'nb_actions');
            $this->processedMetrics = array(
                new AverageTimeOnSite(),
                new BounceRate(),
                new ActionsPerVisit()
            );
        } else {
            return false;
        }

I want to write my own plugin later after the test phase but now I need a quick solution. Did someone have a similar problem?


That’s how it looks like when the names of the CustomDimensions aren’t displayed correctly, it works fine in the other folder though.

Hi Tatiana.
Are you still working on that? I recently found a solution for placing custom dimensions anywhere you want (by registering an event).

Unfortunately yes, and I’m a little bit overwhelmed by Matomo, as I’m not dealing with this very long.
I’ve red the Events Documentation and see the idea behind this. If I understand this right I need the right refferer in the registerevent Function, so my event is triggered in the right moment. Do you know where I could find the right refferer for the CustomActiionDimensions?