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
63
www/analytics/plugins/Goals/Reports/Base.php
Normal file
63
www/analytics/plugins/Goals/Reports/Base.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Goals\Reports;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Plugins\Goals\API;
|
||||
use Piwik\Plugins\Goals\Goals;
|
||||
|
||||
abstract class Base extends \Piwik\Plugin\Report
|
||||
{
|
||||
protected $orderGoal = 50;
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->category = 'Goals_Goals';
|
||||
}
|
||||
|
||||
protected function addReportMetadataForEachGoal(&$availableReports, $infos, $goalNameFormatter)
|
||||
{
|
||||
$idSite = $this->getIdSiteFromInfos($infos);
|
||||
$goals = $this->getGoalsForIdSite($idSite);
|
||||
|
||||
foreach ($goals as $goal) {
|
||||
$goal['name'] = Common::sanitizeInputValue($goal['name']);
|
||||
|
||||
$this->name = $goalNameFormatter($goal);
|
||||
$this->parameters = array('idGoal' => $goal['idgoal']);
|
||||
$this->order = $this->orderGoal + $goal['idgoal'] * 3;
|
||||
|
||||
$availableReports[] = $this->buildReportMetadata();
|
||||
}
|
||||
|
||||
$this->init();
|
||||
}
|
||||
|
||||
protected function getIdSiteFromInfos($infos)
|
||||
{
|
||||
$idSites = $infos['idSites'];
|
||||
|
||||
if (count($idSites) != 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$idSite = reset($idSites);
|
||||
|
||||
return $idSite;
|
||||
}
|
||||
|
||||
private function getGoalsForIdSite($idSite)
|
||||
{
|
||||
if (empty($idSite)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
return API::getInstance()->getGoals($idSite);
|
||||
}
|
||||
}
|
||||
40
www/analytics/plugins/Goals/Reports/Get.php
Normal file
40
www/analytics/plugins/Goals/Reports/Get.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Goals\Reports;
|
||||
|
||||
use Piwik\Piwik;
|
||||
|
||||
class Get extends Base
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->name = Piwik::translate('Goals_Goals');
|
||||
$this->processedMetrics = array('conversion_rate');
|
||||
$this->documentation = ''; // TODO
|
||||
$this->order = 1;
|
||||
$this->orderGoal = 50;
|
||||
$this->metrics = array('nb_conversions', 'nb_visits_converted', 'revenue');
|
||||
$this->parameters = null;
|
||||
}
|
||||
|
||||
public function configureReportMetadata(&$availableReports, $infos)
|
||||
{
|
||||
if (!$this->isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
parent::configureReportMetadata($availableReports, $infos);
|
||||
|
||||
$this->addReportMetadataForEachGoal($availableReports, $infos, function ($goal) {
|
||||
return Piwik::translate('Goals_GoalX', $goal['name']);
|
||||
});
|
||||
}
|
||||
}
|
||||
68
www/analytics/plugins/Goals/Reports/GetDaysToConversion.php
Normal file
68
www/analytics/plugins/Goals/Reports/GetDaysToConversion.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Goals\Reports;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\ViewDataTable;
|
||||
use Piwik\Plugins\Goals\Columns\DaysToConversion;
|
||||
use Piwik\Plugins\Goals\Archiver;
|
||||
|
||||
class GetDaysToConversion extends Base
|
||||
{
|
||||
protected $defaultSortColumn = '';
|
||||
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->name = Piwik::translate('Goals_DaysToConv');
|
||||
$this->dimension = new DaysToConversion();
|
||||
$this->constantRowsCount = true;
|
||||
$this->processedMetrics = false;
|
||||
$this->parameters = array();
|
||||
|
||||
$this->metrics = array('nb_conversions');
|
||||
$this->order = 10;
|
||||
$this->orderGoal = 52;
|
||||
}
|
||||
|
||||
public function configureView(ViewDataTable $view)
|
||||
{
|
||||
$view->config->show_search = false;
|
||||
$view->config->show_exclude_low_population = false;
|
||||
$view->config->show_table_all_columns = false;
|
||||
$view->config->show_all_views_icons = false;
|
||||
$view->config->show_offset_information = false;
|
||||
$view->config->show_pagination_control = false;
|
||||
$view->config->columns_to_display = array('label', 'nb_conversions');
|
||||
|
||||
$view->requestConfig->filter_sort_column = 'label';
|
||||
$view->requestConfig->filter_sort_order = 'asc';
|
||||
$view->requestConfig->filter_limit = count(Archiver::$daysToConvRanges);
|
||||
|
||||
$view->config->addTranslations(array('label' => $this->dimension->getName()));
|
||||
}
|
||||
|
||||
public function configureReportMetadata(&$availableReports, $infos)
|
||||
{
|
||||
if (!$this->isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (null !== $this->getIdSiteFromInfos($infos)) {
|
||||
parent::configureReportMetadata($availableReports, $infos);
|
||||
}
|
||||
|
||||
$name = $this->name;
|
||||
|
||||
$this->addReportMetadataForEachGoal($availableReports, $infos, function ($goal) use ($name) {
|
||||
return $goal['name'] . ' - ' . $name;
|
||||
});
|
||||
}
|
||||
}
|
||||
32
www/analytics/plugins/Goals/Reports/GetMetrics.php
Normal file
32
www/analytics/plugins/Goals/Reports/GetMetrics.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Goals\Reports;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugins\CoreHome\Columns\Metrics\ConversionRate;
|
||||
|
||||
class GetMetrics extends Base
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->name = Piwik::translate('Goals_Goals');
|
||||
$this->processedMetrics = array(new ConversionRate());
|
||||
$this->documentation = ''; // TODO
|
||||
$this->order = 1;
|
||||
$this->orderGoal = 50;
|
||||
$this->metrics = array( 'nb_conversions', 'nb_visits_converted', 'revenue');
|
||||
$this->parameters = null;
|
||||
}
|
||||
|
||||
public function configureReportMetadata(&$availableReports, $infos)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Goals\Reports;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\ViewDataTable;
|
||||
use Piwik\Plugins\Goals\Columns\VisitsUntilConversion;
|
||||
use Piwik\Plugins\Goals\Archiver;
|
||||
|
||||
class GetVisitsUntilConversion extends Base
|
||||
{
|
||||
protected $defaultSortColumn = '';
|
||||
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->name = Piwik::translate('Goals_VisitsUntilConv');
|
||||
$this->dimension = new VisitsUntilConversion();
|
||||
$this->constantRowsCount = true;
|
||||
$this->processedMetrics = array();
|
||||
$this->parameters = array();
|
||||
$this->metrics = array('nb_conversions');
|
||||
$this->order = 5;
|
||||
$this->orderGoal = 51;
|
||||
}
|
||||
|
||||
public function configureView(ViewDataTable $view)
|
||||
{
|
||||
$view->config->show_search = false;
|
||||
$view->config->show_exclude_low_population = false;
|
||||
$view->config->show_table_all_columns = false;
|
||||
$view->config->columns_to_display = array('label', 'nb_conversions');
|
||||
$view->config->show_offset_information = false;
|
||||
$view->config->show_pagination_control = false;
|
||||
$view->config->show_all_views_icons = false;
|
||||
|
||||
$view->requestConfig->filter_sort_column = 'label';
|
||||
$view->requestConfig->filter_sort_order = 'asc';
|
||||
$view->requestConfig->filter_limit = count(Archiver::$visitCountRanges);
|
||||
|
||||
$view->config->addTranslations(array('label' => $this->dimension->getName()));
|
||||
}
|
||||
|
||||
public function configureReportMetadata(&$availableReports, $infos)
|
||||
{
|
||||
if (!$this->isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (null !== $this->getIdSiteFromInfos($infos)) {
|
||||
parent::configureReportMetadata($availableReports, $infos);
|
||||
}
|
||||
|
||||
$name = $this->name;
|
||||
|
||||
$this->addReportMetadataForEachGoal($availableReports, $infos, function ($goal) use ($name) {
|
||||
return $goal['name'] . ' - ' . $name;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue