Creating custom report

Hi all, I’ve been using Piwik for some weeks to try out if it fits my needs. I’ve created custom plugin widgets which use a custom table in the piwik table. Everything works how I want (graphs, tables etc).

Now I want these tables and graphs in a report. But I’m doing something wrong because I only get tables in the reports with columns I don’t supply in my Piwik_DataTable.

In “\piwik\plugins\UserSettings\UserSettings.php”: I have added a seperate array


array( 	'UserSettings_VisitorSettings',
				'TestUI Graph',
				'TestUI',
				'getAppViews',
				'Views'),

Which calls this function:


class Piwik_TestUI_API
{
	public function getAppViews()
	{        
		$views = array();
		$value = 10;
		for ($i = 0; $i < 10; $i++)
		{
			$views[$i] = $value++;
		}
		
		// convert this array to a DataTable object
		$dataTable = new Piwik_DataTable();
		$dataTable->addRowsFromArrayWithIndexLabel($views);
		return $dataTable;
	}
}

The report outputted is a table (possible to do graphs?) with the columns ‘Views’ (which has the values of my filled table), and irrelevant columns: ‘Visits’, ‘Unique visitors’, ‘Actions’, etc.

So my questions are:
Why are these columns added? And how do I get rid of it. These are not defined in the Piwik_DataTable.
How can I make a report that looks the same as the widget only outputted to for example PDF?

Nobody?

We haven’t documented this very well, but we should. Please create a ticket in dev.piwik.org with your problem, output results, expected results, thanks

We would like to create a feature in Piwik to let anyone create custom reports with multiple columns and dimensions.

Please put a comment on the following ticket in our ticket tracker: Custom Reports / Pivot table with selectable dimension · Issue #4776 · matomo-org/matomo · GitHub

Thanks for your feedback!

Good news: we have now released the Custom Reports feature for Piwik!

Custom reports lets you choose which dimensions and metrics you want to see. You can combine multiple dimensions (up to 3) and as many metrics as you need.
The custom reports can be emailed to your partners or customers, and have their own menu entry in the Piwik report list. You can even setup advanced filters to further customise the reports.

Learn more about the power of Custom Reports in the user guide: Custom Reports - Analytics Platform - Piwik
or FAQ: Custom Reports - Analytics Platform - Piwik

This premium plugin can be purchased here: https://plugins.piwik.org/CustomReports

and have a wonderful end of year!