I have a custom report using LiveAPI. It lists all userids and their associated custom variables.
It works fine online, but when scheduled it errors out.
I debugged the code and found multiple issues:[ol]
[li] disable_generic_filter was not getting set and so the dataTable would get truncated. Since it is API to API call, the ViewDataTable instance is not available to set ($view->requestConfig->disable_generic_filters=true). I worked around this by disabling the filter in the API - $result->disableFilter(‘AddColumnsProcessedMetrics’); This was the only filter that wiped out the results
[/li][li] My custom API was getting called two times within a request. The first time it had the correct date in the request and the second call had a date range (from the beigining of time to the selected date) and the $period was ‘day’. LiveAPI fails due to incorrect $date and $period combination. So I did some string manipulation of the date and removed the range. The actual problem of it getting called multiple times is still there
[/li][li] The next block -
/piwik/index.php?module=API&action=index&idSite=1&period=day&date=2015-07-09&token_auth=75e2d094d66292a46b9f6f1f53e827a5&method=ScheduledReports.generateReport&idReport=1&outputType=3&language=en - Call to undefined method Piwik\DataTable\Simple::getDataTables() in /home/osboxes/Documents/piwik-2.14/piwik/plugins/ImageGraph/API.php
It is generating a graph for a flat list of userid. This is when I realized that I was wrong in fixing the first two issues. There should be a way to provide report metadata that could be used by scheduled reports.
To put it simply -
Is there an example or guide to make a custom report using LiveAPI work in scheduled report?
The cutom plugin example (showing all browsers) could be expanded to make it work in scheduled reports. That could also help.