Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions plugins/DevicePlugins/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@
*/
class API extends \Piwik\Plugin\API
{
protected function getDataTable($name, $idSite, $period, $date, $segment)
/**
* @param int|string|int[] $idSite
* @param string|null|false $segment
* @return DataTable|DataTable\Map
*/
protected function getDataTable(string $name, $idSite, string $period, string $date, $segment)
{
Piwik::checkUserHasViewAccess($idSite);
$archive = Archive::build($idSite, $period, $date, $segment);
Expand All @@ -38,7 +43,24 @@ protected function getDataTable($name, $idSite, $period, $date, $segment)
return $dataTable;
}

public function getPlugin($idSite, $period, $date, $segment = false)
/**
* Returns metrics for detected browser plugins on the requested site.
*
* @param int|string|int[] $idSite Website ID(s) to query.
* - Single site ID (e.g. 1)
* - Multiple site IDs (e.g. [1, 4, 5])
* - Comma-separated list ("1,4,5") or "all"
* @param 'day'|'week'|'month'|'year'|'range' $period The period to process, processes data for the period
* containing the specified date.
* @param string $date The date or date range to process.
* 'YYYY-MM-DD', magic keywords (today, yesterday, lastWeek, lastMonth, lastYear),
* or date range (ie, 'YYYY-MM-DD,YYYY-MM-DD', lastX, previousX).
* @param string|null|false $segment Custom segment to filter the report.
* Example: "referrerName==example.com"
* Supports AND (;) and OR (,) operators.
* @return DataTable|DataTable\Map Browser plugin metrics with visit percentages.
*/
public function getPlugin($idSite, string $period, string $date, $segment = false)
{
// fetch all archive data required
$dataTable = $this->getDataTable(Archiver::PLUGIN_RECORD_NAME, $idSite, $period, $date, $segment);
Expand Down
Loading