The number of requests for a specific event in Pivik

I need to make a widget / plugin for my organization using Piwik, but I got a little lost. We send special events to Piwik, for example:

Category: Staff 
Action: Login 

How can I request piwik from a widget / plugin to get # events matching that particular category / action?

+4
source share
1 answer

Here is the documentation regarding the API Event .

There are two methods that may interest you:

  • Events.getCategory
  • Events.getAction

They will return a list of actions / categories displayed in nb_uniq_visitors, nb_visitsand nb_events.

nb_events , . :

http://demo.piwik.org/?module=API&method=Events.getCategory&idSite=7&period=day&date=today&format=xml&token_auth=anonymous

, Piwik , Reporting API. , Piwik, .


: , Piwik.

API- . API :

$table = \Piwik\API\Request::processRequest('Events.getCategory', array(
    'idSite' => $idSite,
    'period' => $period,
    'date'   => $date,
));

, , :

$row = $table->getRowFromLabel('Staff');

:

$numberOfEvents = $row->getColumn('nb_events');

, API , , , :

$table = \Piwik\API\Request::processRequest('Events.getCategory', array(
    'idSite'      => $idSite,
    'period'      => $period,
    'date'        => $date,
    'label'       => 'Staff',
    'showColumns' => 'nb_events',
));
+3

All Articles