Matomo:在插件中获取 actionDetails API
Matomo: Get actionDetails in Plugin API
我正在尝试创建自定义报告。我希望它显示 CustomDimensions,我可以在
?module=API&method=Live.getLastVisitsDetails&idSite=1&period=day&date=today&format=JSON&token_auth= under actionDetails.
我尝试按照本文中的说明创建报告:
https://developer.matomo.org/guides/custom-reports-extended
但是当我要求“actionDetails”而不是“browserName”时,我没有得到任何结果。
我的函数如下所示:
$data = \Piwik\API\Request::processRequest('Live.getLastVisitsDetails', array(
'idSite' => $idSite,
'period' => $period,
'date' => $date,
'segment' => $segment,
'numLastVisitorsToFetch' => 100,
'minTimestamp' => false,
'flat' => false,
'doNotFetchActions' => true
));
$data->applyQueuedFilters();
// we could create a new instance by using new DataTable(),
// but we would lose DataTable metadata, which can be useful.
$result = $data->getEmptyClone($keepFilters = false);
foreach ($data->getRows() as $visitRow) {
$actionDetails = $visitRow->getColumn('browserName');
// try and get the row in the result DataTable for the browser
$browserRow = $result->getRowFromLabel($actionDetails);
$test = $visitRow->getColumn('actionDetails');
var_dump($test);
// if there is no row for this browser, create it
if ($browserRow === false) {
$result->addRowFromSimpleArray(array(
'label' => $actionDetails,
'nb_visits' => 1
));
} else { // if there is a row, increment the counter
$counter = $browserRow->getColumn('nb_visits');
$browserRow->setColumn('nb_visits', $counter + 1);
}
}
return $result;
var_dump returns array(0) { } 虽然我打开时可以看到数据 ?module=API&method=Live.getLastVisitsDetails&idSite=1&period= day&date=今天&format=JSON&token_auth= link.
如何获取 actionDetails 数据?
您 'doNotFetchActions' => true
也许将其设置为 false?这将从结果中删除操作。
我正在尝试创建自定义报告。我希望它显示 CustomDimensions,我可以在 ?module=API&method=Live.getLastVisitsDetails&idSite=1&period=day&date=today&format=JSON&token_auth= under actionDetails.
我尝试按照本文中的说明创建报告: https://developer.matomo.org/guides/custom-reports-extended
但是当我要求“actionDetails”而不是“browserName”时,我没有得到任何结果。
我的函数如下所示:
$data = \Piwik\API\Request::processRequest('Live.getLastVisitsDetails', array(
'idSite' => $idSite,
'period' => $period,
'date' => $date,
'segment' => $segment,
'numLastVisitorsToFetch' => 100,
'minTimestamp' => false,
'flat' => false,
'doNotFetchActions' => true
));
$data->applyQueuedFilters();
// we could create a new instance by using new DataTable(),
// but we would lose DataTable metadata, which can be useful.
$result = $data->getEmptyClone($keepFilters = false);
foreach ($data->getRows() as $visitRow) {
$actionDetails = $visitRow->getColumn('browserName');
// try and get the row in the result DataTable for the browser
$browserRow = $result->getRowFromLabel($actionDetails);
$test = $visitRow->getColumn('actionDetails');
var_dump($test);
// if there is no row for this browser, create it
if ($browserRow === false) {
$result->addRowFromSimpleArray(array(
'label' => $actionDetails,
'nb_visits' => 1
));
} else { // if there is a row, increment the counter
$counter = $browserRow->getColumn('nb_visits');
$browserRow->setColumn('nb_visits', $counter + 1);
}
}
return $result;
var_dump returns array(0) { } 虽然我打开时可以看到数据 ?module=API&method=Live.getLastVisitsDetails&idSite=1&period= day&date=今天&format=JSON&token_auth= link.
如何获取 actionDetails 数据?
您 'doNotFetchActions' => true
也许将其设置为 false?这将从结果中删除操作。