update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -13,8 +13,6 @@ use Piwik\DataAccess\LogAggregator;
|
|||
use Piwik\DataArray;
|
||||
use Piwik\DataTable;
|
||||
use Piwik\Metrics;
|
||||
use Piwik\PluginsArchiver;
|
||||
use Piwik\PluginsManager;
|
||||
use Piwik\Tracker\GoalManager;
|
||||
|
||||
class Archiver extends \Piwik\Plugin\Archiver
|
||||
|
|
@ -156,7 +154,6 @@ class Archiver extends \Piwik\Plugin\Archiver
|
|||
// Stats for all goals
|
||||
$nbConvertedVisits = $this->getProcessor()->getNumberOfVisitsConverted();
|
||||
$metrics = array(
|
||||
self::getRecordName('conversion_rate') => $this->getConversionRate($nbConvertedVisits),
|
||||
self::getRecordName('nb_conversions') => $totalConversions,
|
||||
self::getRecordName('nb_visits_converted') => $nbConvertedVisits,
|
||||
self::getRecordName('revenue') => $totalRevenue,
|
||||
|
|
@ -174,11 +171,6 @@ class Archiver extends \Piwik\Plugin\Archiver
|
|||
$recordName = self::getRecordName($metricName, $idGoal);
|
||||
$numericRecords[$recordName] = $value;
|
||||
}
|
||||
if (!empty($array[Metrics::INDEX_GOAL_NB_VISITS_CONVERTED])) {
|
||||
$conversion_rate = $this->getConversionRate($array[Metrics::INDEX_GOAL_NB_VISITS_CONVERTED]);
|
||||
$recordName = self::getRecordName('conversion_rate', $idGoal);
|
||||
$numericRecords[$recordName] = $conversion_rate;
|
||||
}
|
||||
}
|
||||
return $numericRecords;
|
||||
}
|
||||
|
|
@ -188,7 +180,7 @@ class Archiver extends \Piwik\Plugin\Archiver
|
|||
* @param int|bool $idGoal idGoal to return the metrics for, or false to return overall
|
||||
* @return string Archive record name
|
||||
*/
|
||||
static public function getRecordName($recordName, $idGoal = false)
|
||||
public static function getRecordName($recordName, $idGoal = false)
|
||||
{
|
||||
$idGoalStr = '';
|
||||
if ($idGoal !== false) {
|
||||
|
|
@ -197,12 +189,6 @@ class Archiver extends \Piwik\Plugin\Archiver
|
|||
return 'Goal_' . $idGoalStr . $recordName;
|
||||
}
|
||||
|
||||
protected function getConversionRate($count)
|
||||
{
|
||||
$visits = $this->getProcessor()->getNumberOfVisits();
|
||||
return round(100 * $count / $visits, GoalManager::REVENUE_PRECISION);
|
||||
}
|
||||
|
||||
protected function insertReports($recordName, $visitsToConversions)
|
||||
{
|
||||
foreach ($visitsToConversions as $idGoal => $table) {
|
||||
|
|
@ -358,7 +344,7 @@ class Archiver extends \Piwik\Plugin\Archiver
|
|||
return array(GoalManager::IDGOAL_CART, GoalManager::IDGOAL_ORDER);
|
||||
}
|
||||
|
||||
static public function getItemRecordNameAbandonedCart($recordName)
|
||||
public static function getItemRecordNameAbandonedCart($recordName)
|
||||
{
|
||||
return $recordName . '_Cart';
|
||||
}
|
||||
|
|
@ -375,7 +361,15 @@ class Archiver extends \Piwik\Plugin\Archiver
|
|||
foreach ($this->dimensionRecord as $recordName) {
|
||||
$dataTableToSum[] = self::getItemRecordNameAbandonedCart($recordName);
|
||||
}
|
||||
$this->getProcessor()->aggregateDataTableRecords($dataTableToSum);
|
||||
$columnsAggregationOperation = null;
|
||||
|
||||
$this->getProcessor()->aggregateDataTableRecords($dataTableToSum,
|
||||
$maximumRowsInDataTableLevelZero = null,
|
||||
$maximumRowsInSubDataTable = null,
|
||||
$columnToSortByBeforeTruncation = null,
|
||||
$columnsAggregationOperation,
|
||||
$columnsToRenameAfterAggregation = null,
|
||||
$countRowsRecursive = array());
|
||||
|
||||
/*
|
||||
* Archive General Goal metrics
|
||||
|
|
@ -391,28 +385,37 @@ class Archiver extends \Piwik\Plugin\Archiver
|
|||
$fieldsToSum = array();
|
||||
foreach ($goalIdsToSum as $goalId) {
|
||||
$metricsToSum = Goals::getGoalColumns($goalId);
|
||||
unset($metricsToSum[array_search('conversion_rate', $metricsToSum)]);
|
||||
foreach ($metricsToSum as $metricName) {
|
||||
$fieldsToSum[] = self::getRecordName($metricName, $goalId);
|
||||
}
|
||||
}
|
||||
$records = $this->getProcessor()->aggregateNumericMetrics($fieldsToSum);
|
||||
$this->getProcessor()->aggregateNumericMetrics($fieldsToSum);
|
||||
|
||||
$columnsAggregationOperation = null;
|
||||
|
||||
// also recording conversion_rate for each goal
|
||||
foreach ($goalIdsToSum as $goalId) {
|
||||
$nb_conversions = $records[self::getRecordName('nb_visits_converted', $goalId)];
|
||||
$conversion_rate = $this->getConversionRate($nb_conversions);
|
||||
$this->getProcessor()->insertNumericRecord(self::getRecordName('conversion_rate', $goalId), $conversion_rate);
|
||||
|
||||
// sum up the visits to conversion data table & the days to conversion data table
|
||||
$this->getProcessor()->aggregateDataTableRecords(array(
|
||||
self::getRecordName(self::VISITS_UNTIL_RECORD_NAME, $goalId),
|
||||
self::getRecordName(self::DAYS_UNTIL_CONV_RECORD_NAME, $goalId)));
|
||||
$this->getProcessor()->aggregateDataTableRecords(
|
||||
array(self::getRecordName(self::VISITS_UNTIL_RECORD_NAME, $goalId),
|
||||
self::getRecordName(self::DAYS_UNTIL_CONV_RECORD_NAME, $goalId)),
|
||||
$maximumRowsInDataTableLevelZero = null,
|
||||
$maximumRowsInSubDataTable = null,
|
||||
$columnToSortByBeforeTruncation = null,
|
||||
$columnsAggregationOperation,
|
||||
$columnsToRenameAfterAggregation = null,
|
||||
$countRowsRecursive = array());
|
||||
}
|
||||
|
||||
$columnsAggregationOperation = null;
|
||||
// sum up goal overview reports
|
||||
$this->getProcessor()->aggregateDataTableRecords(array(
|
||||
self::getRecordName(self::VISITS_UNTIL_RECORD_NAME),
|
||||
self::getRecordName(self::DAYS_UNTIL_CONV_RECORD_NAME)));
|
||||
$this->getProcessor()->aggregateDataTableRecords(
|
||||
array(self::getRecordName(self::VISITS_UNTIL_RECORD_NAME),
|
||||
self::getRecordName(self::DAYS_UNTIL_CONV_RECORD_NAME)),
|
||||
$maximumRowsInDataTableLevelZero = null,
|
||||
$maximumRowsInSubDataTable = null,
|
||||
$columnToSortByBeforeTruncation = null,
|
||||
$columnsAggregationOperation,
|
||||
$columnsToRenameAfterAggregation = null,
|
||||
$countRowsRecursive = array());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue