diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-08-27 13:49:59 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-08-27 13:49:59 +0400 |
commit | ce8d27ce90be5be96ae540cc5805c34601590260 (patch) | |
tree | 5059abf4e95cc5bd83546213cde41f7fbce7bb00 /plugins/Contents/DataArray.php | |
parent | 18e7b5688e7ae40a24801e2f3bd9eec867ba8c16 (diff) |
refs #4996 interactions should be tracked now. As only the name is really mandatory created a new column content_name for now (instead of existing idaction_name, will maybe remove it again). Otherwise it is hard to know whether it was a content action or not and the actual problem was that maybe other actions already define an idaction_name which might be different to content_name. We need the content_name along other actions to match an interaction with an impression. Next: The client side and the redirect...
Diffstat (limited to 'plugins/Contents/DataArray.php')
-rw-r--r-- | plugins/Contents/DataArray.php | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/plugins/Contents/DataArray.php b/plugins/Contents/DataArray.php index f83f06f624..98e7b0543c 100644 --- a/plugins/Contents/DataArray.php +++ b/plugins/Contents/DataArray.php @@ -19,12 +19,20 @@ use Piwik\Metrics; class DataArray extends \Piwik\DataArray { - public function sumMetricsContents($label, $row) + public function sumMetricsImpressions($label, $row) { if (!isset($this->data[$label])) { $this->data[$label] = self::makeEmptyContentsRow(); } - $this->doSumContentsMetrics($row, $this->data[$label], $onlyMetricsAvailableInActionsTable = true); + $this->doSumContentsImpressionMetrics($row, $this->data[$label]); + } + + public function sumMetricsInteractions($label, $row) + { + if (!isset($this->data[$label])) { + return; // do igonre interactions that do not have an impression + } + $this->doSumContentsInteractionMetrics($row, $this->data[$label]); } protected static function makeEmptyContentsRow() @@ -37,24 +45,32 @@ class DataArray extends \Piwik\DataArray ); } - /** - * @param array $newRowToAdd - * @param array $oldRowToUpdate - * @return void - */ - protected function doSumContentsMetrics($newRowToAdd, &$oldRowToUpdate) + protected function doSumContentsImpressionMetrics($newRowToAdd, &$oldRowToUpdate) { $oldRowToUpdate[Metrics::INDEX_NB_VISITS] += $newRowToAdd[Metrics::INDEX_NB_VISITS]; $oldRowToUpdate[Metrics::INDEX_NB_UNIQ_VISITORS] += $newRowToAdd[Metrics::INDEX_NB_UNIQ_VISITORS]; $oldRowToUpdate[Metrics::INDEX_CONTENT_NB_IMPRESSIONS] += $newRowToAdd[Metrics::INDEX_CONTENT_NB_IMPRESSIONS]; } - public function sumMetricsContentsPivot($parentLabel, $label, $row) + protected function doSumContentsInteractionMetrics($newRowToAdd, &$oldRowToUpdate) + { + $oldRowToUpdate[Metrics::INDEX_CONTENT_NB_INTERACTIONS] += $newRowToAdd[Metrics::INDEX_CONTENT_NB_INTERACTIONS]; + } + + public function sumMetricsContentsImpressionPivot($parentLabel, $label, $row) { if (!isset($this->dataTwoLevels[$parentLabel][$label])) { $this->dataTwoLevels[$parentLabel][$label] = $this->makeEmptyContentsRow(); } - $this->doSumContentsMetrics($row, $this->dataTwoLevels[$parentLabel][$label]); + $this->doSumContentsImpressionMetrics($row, $this->dataTwoLevels[$parentLabel][$label]); + } + + public function sumMetricsContentsInteractionPivot($parentLabel, $label, $row) + { + if (!isset($this->dataTwoLevels[$parentLabel][$label])) { + return; // do igonre interactions that do not have an impression + } + $this->doSumContentsInteractionMetrics($row, $this->dataTwoLevels[$parentLabel][$label]); } } |