I created a custom report in a custom plugin with the following API function:
public function getCustomReport($idSite, $period, $date, $segment)
{
$segment = 'customVariablePageName1==Host;customVariablePageValue1==RequestedHost';
return \Piwik\Plugins\VisitsSummary\API::getInstance()->get($idSite, $period, $date, $segment, 'nb_visits,nb_actions,nb_uniq_visits');
}
Now when I try to change period or ‘rows to display’ I always get the following error:
Oops… there was a problem during the request. Maybe the server had a temporary issue, or maybe you requested a report with too much data. Please try again. If this error occurs repeatedly please contact your Matomo administrator for assistance.
Need more help? FAQ – Community Help – Professional Help.
This is my GetCustomReport.php file in Reports:
<?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\Jobby\Reports;
use Piwik\Piwik;
use Piwik\Plugin\Report;
use Piwik\Plugin\ViewDataTable;
use Piwik\Plugins\VisitorInterest\Columns\VisitsbyVisitNumber;
use Piwik\View;
/**
* This class defines a new report.
*
* See {@link http://developer.piwik.org/api-reference/Piwik/Plugin/Report} for more information.
*/
class GetCustomReport extends Base
{
protected function init()
{
parent::init();
$this->name = Piwik::translate('Custom Report');
$this->dimension = new VisitsbyVisitNumber();
$this->documentation = Piwik::translate('');
$this->subcategoryId = $this->name;
$this->categoryId = 'Portale';
$this->order = 1;
}
/**
* Here you can configure how your report should be displayed. For instance whether your report supports a search
* etc. You can also change the default request config. For instance change how many rows are displayed by default.
*
* @param ViewDataTable $view
*/
public function configureView(ViewDataTable $view)
{
if (!empty($this->dimension)) {
$view->config->addTranslations(array('label' => $this->dimension->getName()));
}
$view->config->columns_to_display = $this->metrics;
}
/**
* Here you can define related reports that will be shown below the reports. Just return an array of related
* report instances if there are any.
*
* @return \Piwik\Plugin\Report[]
*/
public function getRelatedReports()
{
return array(); // eg return array(new XyzReport());
}
}
Does anybody know what I’m doing wrong or why I can’t change those values?