Metadata for Custom Plugins

I have quite a lot of custom plugins on my Piwik installation, since I’m using Piwik for non-web analytics. My custom data is stored in a Mongo database, and my plugins’ API objects get their data directly from this.

I’d like to use some of the new features of Piwik 1.8.2 in these plugins. To do this, I need metadata, which I’ve worked out should come from the Piwik_CustomPlugin object’s getReportMetadata method. This has an argument $notifications, and in a standard plugin, it begins with the lines

$reports = &$notification->getNotificationObject();
$reports[]=array(
…);

I’ve worked out that this array needs to contain
’metrics’ => array();

which is an associative array. But where do I get the key/value pairs that I put in that array?

Key is the metric name, value is the metric description (metrics are the data table columns)