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?