I’m having some difficulty getting a widget to display the data I’d like. Here are the pieces to the puzzle:
PHP page accepting a PIWIK site-ID that returns a paragraph of stats, etc. ex: http://mydomain.com/stats.php?site_id=42 will return plain text, which is exactly what I want to display in the widget
Blank PIWIK widget created with ./console generate:plugin and ./console generate:controller… I also created a report called “GetVideoAnalytics”
In API.php, I have the default code, which does display a table, as expected:
public function getVideoAnalytics($idSite, $period, $date, $segment = false)
$table = new DataTable();
$table->addRowFromArray(array(Row::COLUMNS => array(‘nb_visits’ => 5)));
My question is… How can I connect these pieces in such a way that my external report (which requires a site-ID) is displayed in the widget? I do not want to display a table or graph in the widget. I simply want to print out a string returned by an HTTP request.
I have looked over How to add new pages and menu items to Piwik – Introducing the Piwik Platform - Analytics Platform - Matomo and Report visualizations: Develop - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3
Those pages have been helpful in getting me started. There is info on displaying custom text within the widget, but it appears those methods don’t have access to the site-ID. Any further info on this subject would be greatly appreciated!