Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@matomo.org>2022-02-23 11:48:02 +0300
committerGitHub <noreply@github.com>2022-02-23 11:48:02 +0300
commitc03828905dcdde1e1a0cf3cab23ad02be8cf16c7 (patch)
tree3f4b92def13c91b42503dfeea75556f4128ce9c5 /plugins
parent73c09aa3c5b09de07a35488f890a7059a1ea9aef (diff)
Check all subordinated sites when deciding whether to calculate main conversion metrics (#18836)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Goals/Archiver.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/plugins/Goals/Archiver.php b/plugins/Goals/Archiver.php
index 08575466da..de991c3100 100644
--- a/plugins/Goals/Archiver.php
+++ b/plugins/Goals/Archiver.php
@@ -129,7 +129,7 @@ class Archiver extends \Piwik\Plugin\Archiver
private function hasAnyGoalOrEcommerce($idSite)
{
- return $this->usesEcommerce($idSite) || GoalManager::getGoalIds($idSite);
+ return $this->usesEcommerce($idSite) || !empty(GoalManager::getGoalIds($idSite));
}
private function usesEcommerce($idSite)
@@ -154,9 +154,25 @@ class Archiver extends \Piwik\Plugin\Archiver
$goals = new DataArray();
$visitsToConversions = $daysToConversions = [];
+ $siteHasEcommerceOrGoals = $this->hasAnyGoalOrEcommerce($this->getSiteId());
+
+ // Special handling for sites that contain subordinated sites, like in roll up reporting.
+ // A roll up site, might not have ecommerce enabled or any configured goals,
+ // but if a subordinated site has, we calculate the overview conversion metrics nevertheless
+ if ($siteHasEcommerceOrGoals === false) {
+ $idSitesToArchive = $this->getProcessor()->getParams()->getIdSites();
+
+ foreach ($idSitesToArchive as $idSite) {
+ if ($this->hasAnyGoalOrEcommerce($idSite)) {
+ $siteHasEcommerceOrGoals = true;
+ break;
+ }
+ }
+ }
+
// try to query goal data only, if goals or ecommerce is actually used
// otherwise we simply insert empty records
- if ($this->hasAnyGoalOrEcommerce($this->getSiteId())) {
+ if ($siteHasEcommerceOrGoals) {
$selects = [];
$selects = array_merge($selects, LogAggregator::getSelectsFromRangedColumn(
self::VISITS_COUNT_FIELD, self::$visitCountRanges, self::LOG_CONVERSION_TABLE, $prefixes[self::VISITS_UNTIL_RECORD_NAME]