Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#1485 closed New feature (fixed)

Piwik plugins define their API metadata and returns ready to be displayed reports

Reported by: matt Owned by:
Priority: major Milestone: Piwik 0.6.4
Component: Core Keywords:
Cc: Sensitive: no

Description

Required by various plugins, Custom Alerts, PDF generation, custom graph builder, etc.

It should also be used by the Mobile Piwik eventually.

Goal is to have each plugin define the list of API reports they offer:

  • group name
  • report name
  • api method & function to call to request data
  • list of metrics that will be returned + translations in requested language

Note: other plugins can add metrics to other reports too, such as the Goal plugin will add revenue/conversion/conversion rate to all segments that have this data.

Change History (8)

comment:1 Changed 4 years ago by matt (mattab)

  • Resolution set to fixed
  • Status changed from new to closed

(In [2549]) Fixes #1485

  • Adding XML export of multi dim arrays
  • Adding metadata for all plugins that define the API functions, metrics, dimensions, category, report name, metrics translations
  • Could well be extended to include 100% of Piwik report metadata later
  • cleaning up Goals API returned values to ensure consistency with other responses in piwik APIs

comment:2 Changed 4 years ago by matt (mattab)

See Follow up ticket in #1491

comment:3 Changed 4 years ago by matt (mattab)

(In [2594]) Refs #1485

  • Fixing wrong metadata for all plugins, cleaning up columns and ensure consistency in API (eg. VisitsSummary.get now returns conversion rate with %)
  • Adding a generic filter Truncate, updated doc at: http://dev.piwik.org/trac/wiki/API/Reference filter_truncate ; if set, will truncate the table after $filter_truncate rows. The last row will be named 'Others' (localized in the requested language) and the columns will be an aggregate of statistics of all truncated rows.
  • Adding common helpers to get a "pretty" value from a given metric and column name
  • Adding new time export format that will be used in PDF reports 12:34:56 format

Refs #1486

  • a new filter, AddColumnsProcessedMetricsGoal, can be reused to easily add processed goal metrics for a given datatable. For example:

$dataTable->filter('AddColumnsProcessedMetricsGoal', array($enable=true, Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_FULL_TABLE));
will process all goal metrics (and per goal conv rate, rev per visit, conversions).
When possible, only reports necessary should be loaded using GOALS_MINIMAL_REPORT or GOALS_OVERVIEW or a given idGoal

comment:4 Changed 4 years ago by matt (mattab)

(In [2641]) Fixes some issues found in error logs when called with a previous URL format. refactored how to get arrays in API functions in a helper method. Not ideal, but better than before..
Also adding filter Truncate mentionned in refs #1485

comment:5 Changed 4 years ago by matt (mattab)

(In [2663]) Refs #1485

  • Adding a magic method to request a given report but with all the metadata returned (report name, column list, translations, etc.) as well as the data, already filtered, ready to be displayed. I think this could be incredibly useful to Mobile Piwik Client!! Check out: getProcessedReport($idSite, $date, $period, $apiModule, $apiAction, $apiParameters = false)
  • This is used in the future PDF export plugin refs #71
  • Minor updates to UI text

comment:6 Changed 4 years ago by matt (mattab)

  • Summary changed from Piwik plugins define their API metadata to Piwik plugins define their API metadata and returns ready to be displayed reports

comment:7 Changed 4 years ago by matt (mattab)

(In [2671]) Refs #1485

  • Ensuring consistency in returned data (zero values are 0% or € 0). Also consistency in rounding.
  • Adding test string returned API.getReport() date + metadata for visit with goal conversion
  • Also adding logo.tpl in the release + helper method to access it (will be used to display in logo in PDF for example. Could later be customizable per-site or globally eg.)

comment:8 Changed 4 years ago by matt (mattab)

(In [2746]) Refs #1485 Better reports/column order in Metadata response + fixing small issues with metadata

Note: See TracTickets for help on using tickets.