update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
9abe039dc8
commit
47263617c5
53 changed files with 418860 additions and 226988 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -9,13 +9,40 @@
|
|||
namespace Piwik\Plugins\Events;
|
||||
|
||||
use Piwik\Archive;
|
||||
use Piwik\DataTable;
|
||||
use Piwik\DataTable\Row;
|
||||
use Piwik\DataTable;
|
||||
use Piwik\Metrics;
|
||||
use Piwik\Piwik;
|
||||
|
||||
/**
|
||||
* Custom Events API
|
||||
* The Events API lets you request reports about your users' Custom Events.
|
||||
*
|
||||
* Events are tracked using the Javascript Tracker trackEvent() function, or using the [Tracking HTTP API](http://developer.piwik.org/api-reference/tracking-api).
|
||||
*
|
||||
* <br/>An event is defined by an event category (Videos, Music, Games...),
|
||||
* an event action (Play, Pause, Duration, Add Playlist, Downloaded, Clicked...),
|
||||
* and an optional event name (a movie name, a song title, etc.) and an optional numeric value.
|
||||
*
|
||||
* <br/>This API exposes the following Custom Events reports: `getCategory` lists the top Event Categories,
|
||||
* `getAction` lists the top Event Actions, `getName` lists the top Event Names.
|
||||
*
|
||||
* <br/>These Events report define the following metrics: nb_uniq_visitors, nb_visits, nb_events.
|
||||
* If you define values for your events, you can expect to see the following metrics: nb_events_with_value,
|
||||
* sum_event_value, min_event_value, max_event_value, avg_event_value
|
||||
*
|
||||
* <br/>The Events.get* reports can be used with an optional `&secondaryDimension` parameter.
|
||||
* Secondary dimension is the dimension used in the sub-table of the Event report you are requesting.
|
||||
*
|
||||
* <br/>Here are the possible values of `secondaryDimension`: <ul>
|
||||
* <li>For `Events.getCategory` you can set `secondaryDimension` to `eventAction` or `eventName`.</li>
|
||||
* <li>For `Events.getAction` you can set `secondaryDimension` to `eventName` or `eventCategory`.</li>
|
||||
* <li>For `Events.getName` you can set `secondaryDimension` to `eventAction` or `eventCategory`.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <br/>For example, to request all Custom Events Categories, and for each, the top Event actions,
|
||||
* you would request: `method=Events.getCategory&secondaryDimension=eventAction&flat=1`.
|
||||
* You may also omit `&flat=1` in which case, to get top Event actions for one Event category,
|
||||
* use `method=Events.getActionFromCategoryId` passing it the `&idSubtable=` of this Event category.
|
||||
*
|
||||
* @package Events
|
||||
* @method static \Piwik\Plugins\Events\API getInstance()
|
||||
|
|
@ -67,24 +94,23 @@ class API extends \Piwik\Plugin\API
|
|||
*/
|
||||
public function getDefaultSecondaryDimension($apiMethod)
|
||||
{
|
||||
if(isset($this->defaultMappingApiToSecondaryDimension[$apiMethod])) {
|
||||
if (isset($this->defaultMappingApiToSecondaryDimension[$apiMethod])) {
|
||||
return $this->defaultMappingApiToSecondaryDimension[$apiMethod];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
protected function getRecordNameForAction($apiMethod, $secondaryDimension = false)
|
||||
{
|
||||
if (empty($secondaryDimension)) {
|
||||
$secondaryDimension = $this->getDefaultSecondaryDimension($apiMethod);
|
||||
}
|
||||
$record = $this->mappingApiToRecord[$apiMethod];
|
||||
if(!is_array($record)) {
|
||||
if (!is_array($record)) {
|
||||
return $record;
|
||||
}
|
||||
// when secondaryDimension is incorrectly set
|
||||
if(empty($record[$secondaryDimension])) {
|
||||
if (empty($record[$secondaryDimension])) {
|
||||
return key($record);
|
||||
}
|
||||
return $record[$secondaryDimension];
|
||||
|
|
@ -98,7 +124,7 @@ class API extends \Piwik\Plugin\API
|
|||
public function getSecondaryDimensions($apiMethod)
|
||||
{
|
||||
$records = $this->mappingApiToRecord[$apiMethod];
|
||||
if(!is_array($records)) {
|
||||
if (!is_array($records)) {
|
||||
return false;
|
||||
}
|
||||
return array_keys($records);
|
||||
|
|
@ -122,29 +148,44 @@ class API extends \Piwik\Plugin\API
|
|||
}
|
||||
}
|
||||
|
||||
protected function getDataTable($name, $idSite, $period, $date, $segment, $expanded = false, $idSubtable = null, $secondaryDimension = false)
|
||||
protected function getDataTable($name, $idSite, $period, $date, $segment, $expanded = false, $idSubtable = null, $secondaryDimension = false, $flat = false)
|
||||
{
|
||||
Piwik::checkUserHasViewAccess($idSite);
|
||||
$this->checkSecondaryDimension($name, $secondaryDimension);
|
||||
$recordName = $this->getRecordNameForAction($name, $secondaryDimension);
|
||||
$dataTable = Archive::getDataTableFromArchive($recordName, $idSite, $period, $date, $segment, $expanded, $idSubtable);
|
||||
$this->filterDataTable($dataTable);
|
||||
|
||||
$dataTable = Archive::createDataTableFromArchive($recordName, $idSite, $period, $date, $segment, $expanded, $flat, $idSubtable);
|
||||
|
||||
if ($flat) {
|
||||
$dataTable->filterSubtables('Piwik\Plugins\Events\DataTable\Filter\ReplaceEventNameNotSet');
|
||||
} else {
|
||||
$dataTable->filter('AddSegmentValue', array(function ($label) {
|
||||
if ($label === Archiver::EVENT_NAME_NOT_SET) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $label;
|
||||
}));
|
||||
}
|
||||
|
||||
$dataTable->filter('Piwik\Plugins\Events\DataTable\Filter\ReplaceEventNameNotSet');
|
||||
|
||||
return $dataTable;
|
||||
}
|
||||
|
||||
public function getCategory($idSite, $period, $date, $segment = false, $expanded = false, $secondaryDimension = false)
|
||||
public function getCategory($idSite, $period, $date, $segment = false, $expanded = false, $secondaryDimension = false, $flat = false)
|
||||
{
|
||||
return $this->getDataTable(__FUNCTION__, $idSite, $period, $date, $segment, $expanded, $idSubtable = false, $secondaryDimension);
|
||||
return $this->getDataTable(__FUNCTION__, $idSite, $period, $date, $segment, $expanded, $idSubtable = false, $secondaryDimension, $flat);
|
||||
}
|
||||
|
||||
public function getAction($idSite, $period, $date, $segment = false, $expanded = false, $secondaryDimension = false)
|
||||
public function getAction($idSite, $period, $date, $segment = false, $expanded = false, $secondaryDimension = false, $flat = false)
|
||||
{
|
||||
return $this->getDataTable(__FUNCTION__, $idSite, $period, $date, $segment, $expanded, $idSubtable = false, $secondaryDimension);
|
||||
return $this->getDataTable(__FUNCTION__, $idSite, $period, $date, $segment, $expanded, $idSubtable = false, $secondaryDimension, $flat);
|
||||
}
|
||||
|
||||
public function getName($idSite, $period, $date, $segment = false, $expanded = false, $secondaryDimension = false)
|
||||
public function getName($idSite, $period, $date, $segment = false, $expanded = false, $secondaryDimension = false, $flat = false)
|
||||
{
|
||||
return $this->getDataTable(__FUNCTION__, $idSite, $period, $date, $segment, $expanded, $idSubtable = false, $secondaryDimension);
|
||||
return $this->getDataTable(__FUNCTION__, $idSite, $period, $date, $segment, $expanded, $idSubtable = false, $secondaryDimension, $flat);
|
||||
}
|
||||
|
||||
public function getActionFromCategoryId($idSite, $period, $date, $idSubtable, $segment = false)
|
||||
|
|
@ -176,29 +217,4 @@ class API extends \Piwik\Plugin\API
|
|||
{
|
||||
return $this->getDataTable(__FUNCTION__, $idSite, $period, $date, $segment, $expanded = false, $idSubtable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DataTable $dataTable
|
||||
*/
|
||||
protected function filterDataTable($dataTable)
|
||||
{
|
||||
$dataTable->filter('Sort', array(Metrics::INDEX_NB_VISITS));
|
||||
$dataTable->queueFilter('ReplaceColumnNames');
|
||||
$dataTable->queueFilter('ReplaceSummaryRowLabel');
|
||||
$dataTable->filter(function (DataTable $table) {
|
||||
$row = $table->getRowFromLabel(Archiver::EVENT_NAME_NOT_SET);
|
||||
if ($row) {
|
||||
$row->setColumn('label', Piwik::translate('General_NotDefined', Piwik::translate('Events_EventName')));
|
||||
}
|
||||
});
|
||||
|
||||
// add processed metric avg_event_value
|
||||
$dataTable->queueFilter('ColumnCallbackAddColumnQuotient',
|
||||
array('avg_event_value',
|
||||
'sum_event_value',
|
||||
'nb_events_with_value',
|
||||
$precision = 2,
|
||||
$shouldSkipRows = true)
|
||||
);
|
||||
}
|
||||
}
|
||||
96
www/analytics/plugins/Events/Actions/ActionEvent.php
Normal file
96
www/analytics/plugins/Events/Actions/ActionEvent.php
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\Events\Actions;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Tracker\Action;
|
||||
use Piwik\Tracker\Request;
|
||||
use Piwik\Tracker;
|
||||
|
||||
/**
|
||||
* An Event is composed of a URL, a Category name, an Action name, and optionally a Name and Value.
|
||||
*
|
||||
*/
|
||||
class ActionEvent extends Action
|
||||
{
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
parent::__construct(Action::TYPE_EVENT, $request);
|
||||
|
||||
$url = $request->getParam('url');
|
||||
|
||||
$this->setActionUrl($url);
|
||||
$this->eventValue = trim($request->getParam('e_v'));
|
||||
}
|
||||
|
||||
public static function shouldHandle(Request $request)
|
||||
{
|
||||
$eventCategory = $request->getParam('e_c');
|
||||
$eventAction = $request->getParam('e_a');
|
||||
|
||||
return (strlen($eventCategory) > 0 && strlen($eventAction) > 0);
|
||||
}
|
||||
|
||||
public function getEventAction()
|
||||
{
|
||||
return $this->request->getParam('e_a');
|
||||
}
|
||||
|
||||
public function getEventCategory()
|
||||
{
|
||||
return $this->request->getParam('e_c');
|
||||
}
|
||||
|
||||
public function getEventName()
|
||||
{
|
||||
return $this->request->getParam('e_n');
|
||||
}
|
||||
|
||||
public function getCustomFloatValue()
|
||||
{
|
||||
return $this->eventValue;
|
||||
}
|
||||
|
||||
protected function getActionsToLookup()
|
||||
{
|
||||
$actionUrl = false;
|
||||
|
||||
$url = $this->getActionUrl();
|
||||
|
||||
if (!empty($url)) {
|
||||
// normalize urls by stripping protocol and www
|
||||
$url = Tracker\PageUrl::normalizeUrl($url);
|
||||
$actionUrl = array($url['url'], $this->getActionType(), $url['prefixId']);
|
||||
}
|
||||
|
||||
return array('idaction_url' => $actionUrl);
|
||||
}
|
||||
|
||||
// Do not track this Event URL as Entry/Exit Page URL (leave the existing entry/exit)
|
||||
public function getIdActionUrlForEntryAndExitIds()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do not track this Event Name as Entry/Exit Page Title (leave the existing entry/exit)
|
||||
public function getIdActionNameForEntryAndExitIds()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function writeDebugInfo()
|
||||
{
|
||||
$write = parent::writeDebugInfo();
|
||||
if ($write) {
|
||||
Common::printDebug("Event Value = " . $this->getCustomFloatValue());
|
||||
}
|
||||
return $write;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -98,7 +98,16 @@ class Archiver extends \Piwik\Plugin\Archiver
|
|||
public function aggregateMultipleReports()
|
||||
{
|
||||
$dataTableToSum = $this->getRecordNames();
|
||||
$this->getProcessor()->aggregateDataTableRecords($dataTableToSum, $this->maximumRowsInDataTable, $this->maximumRowsInSubDataTable, $this->columnToSortByBeforeTruncation);
|
||||
$columnsAggregationOperation = null;
|
||||
|
||||
$this->getProcessor()->aggregateDataTableRecords(
|
||||
$dataTableToSum,
|
||||
$this->maximumRowsInDataTable,
|
||||
$this->maximumRowsInSubDataTable,
|
||||
$this->columnToSortByBeforeTruncation,
|
||||
$columnsAggregationOperation,
|
||||
$columnsToRenameAfterAggregation = null,
|
||||
$countRowsRecursive = array());
|
||||
}
|
||||
|
||||
protected function getRecordNames()
|
||||
|
|
@ -179,18 +188,17 @@ class Archiver extends \Piwik\Plugin\Archiver
|
|||
$rankingQuery->addColumn(Metrics::INDEX_EVENT_MAX_EVENT_VALUE, 'max');
|
||||
}
|
||||
|
||||
$this->archiveDayQueryProcess($select, $from, $where, $orderBy, $groupBy, $rankingQuery);
|
||||
$this->archiveDayQueryProcess($select, $from, $where, $groupBy, $orderBy, $rankingQuery);
|
||||
}
|
||||
|
||||
|
||||
protected function archiveDayQueryProcess($select, $from, $where, $orderBy, $groupBy, RankingQuery $rankingQuery)
|
||||
protected function archiveDayQueryProcess($select, $from, $where, $groupBy, $orderBy, RankingQuery $rankingQuery)
|
||||
{
|
||||
// get query with segmentation
|
||||
$query = $this->getLogAggregator()->generateQuery($select, $from, $where, $groupBy, $orderBy);
|
||||
|
||||
// apply ranking query
|
||||
if ($rankingQuery) {
|
||||
$query['sql'] = $rankingQuery->generateQuery($query['sql']);
|
||||
$query['sql'] = $rankingQuery->generateRankingQuery($query['sql']);
|
||||
}
|
||||
|
||||
// get result
|
||||
|
|
@ -205,7 +213,6 @@ class Archiver extends \Piwik\Plugin\Archiver
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Records the daily datatables
|
||||
*/
|
||||
|
|
@ -227,7 +234,7 @@ class Archiver extends \Piwik\Plugin\Archiver
|
|||
*/
|
||||
protected function getDataArray($name)
|
||||
{
|
||||
if(empty($this->arrays[$name])) {
|
||||
if (empty($this->arrays[$name])) {
|
||||
$this->arrays[$name] = new DataArray();
|
||||
}
|
||||
return $this->arrays[$name];
|
||||
|
|
|
|||
56
www/analytics/plugins/Events/Columns/EventAction.php
Normal file
56
www/analytics/plugins/Events/Columns/EventAction.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Events\Columns;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\Dimension\ActionDimension;
|
||||
use Piwik\Plugins\Events\Segment;
|
||||
use Piwik\Plugins\Events\Actions\ActionEvent;
|
||||
use Piwik\Tracker\Action;
|
||||
use Piwik\Tracker\Request;
|
||||
|
||||
class EventAction extends ActionDimension
|
||||
{
|
||||
protected $columnName = 'idaction_event_action';
|
||||
protected $columnType = 'INTEGER(10) UNSIGNED DEFAULT NULL';
|
||||
|
||||
protected function configureSegments()
|
||||
{
|
||||
$segment = new Segment();
|
||||
$segment->setSegment('eventAction');
|
||||
$segment->setName('Events_EventAction');
|
||||
$this->addSegment($segment);
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return Piwik::translate('Events_EventAction');
|
||||
}
|
||||
|
||||
public function getActionId()
|
||||
{
|
||||
return Action::TYPE_EVENT_ACTION;
|
||||
}
|
||||
|
||||
public function onLookupAction(Request $request, Action $action)
|
||||
{
|
||||
if (!($action instanceof ActionEvent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$eventAction = $request->getParam('e_a');
|
||||
$eventAction = trim($eventAction);
|
||||
|
||||
if (strlen($eventAction) > 0) {
|
||||
return $eventAction;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
56
www/analytics/plugins/Events/Columns/EventCategory.php
Normal file
56
www/analytics/plugins/Events/Columns/EventCategory.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Events\Columns;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\Dimension\ActionDimension;
|
||||
use Piwik\Plugins\Events\Segment;
|
||||
use Piwik\Plugins\Events\Actions\ActionEvent;
|
||||
use Piwik\Tracker\Action;
|
||||
use Piwik\Tracker\Request;
|
||||
|
||||
class EventCategory extends ActionDimension
|
||||
{
|
||||
protected $columnName = 'idaction_event_category';
|
||||
protected $columnType = 'INTEGER(10) UNSIGNED DEFAULT NULL';
|
||||
|
||||
protected function configureSegments()
|
||||
{
|
||||
$segment = new Segment();
|
||||
$segment->setSegment('eventCategory');
|
||||
$segment->setName('Events_EventCategory');
|
||||
$this->addSegment($segment);
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return Piwik::translate('Events_EventCategory');
|
||||
}
|
||||
|
||||
public function getActionId()
|
||||
{
|
||||
return Action::TYPE_EVENT_CATEGORY;
|
||||
}
|
||||
|
||||
public function onLookupAction(Request $request, Action $action)
|
||||
{
|
||||
if (!($action instanceof ActionEvent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$eventCategory = $request->getParam('e_c');
|
||||
$eventCategory = trim($eventCategory);
|
||||
|
||||
if (strlen($eventCategory) > 0) {
|
||||
return $eventCategory;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
55
www/analytics/plugins/Events/Columns/EventName.php
Normal file
55
www/analytics/plugins/Events/Columns/EventName.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Events\Columns;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\Dimension\ActionDimension;
|
||||
use Piwik\Plugins\Events\Segment;
|
||||
use Piwik\Plugins\Events\Actions\ActionEvent;
|
||||
use Piwik\Tracker\Action;
|
||||
use Piwik\Tracker\Request;
|
||||
|
||||
class EventName extends ActionDimension
|
||||
{
|
||||
protected $columnName = 'idaction_name';
|
||||
|
||||
protected function configureSegments()
|
||||
{
|
||||
$segment = new Segment();
|
||||
$segment->setSegment('eventName');
|
||||
$segment->setName('Events_EventName');
|
||||
$this->addSegment($segment);
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return Piwik::translate('Events_EventName');
|
||||
}
|
||||
|
||||
public function getActionId()
|
||||
{
|
||||
return Action::TYPE_EVENT_NAME;
|
||||
}
|
||||
|
||||
public function onLookupAction(Request $request, Action $action)
|
||||
{
|
||||
if (!($action instanceof ActionEvent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$eventName = $request->getParam('e_n');
|
||||
$eventName = trim($eventName);
|
||||
|
||||
if (strlen($eventName) > 0) {
|
||||
return $eventName;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Plugins\Events\Columns\Metrics;
|
||||
|
||||
use Piwik\DataTable\Row;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\ProcessedMetric;
|
||||
|
||||
/**
|
||||
* The average value for a triggered event. Calculated as:
|
||||
*
|
||||
* sum_event_value / nb_events_with_value
|
||||
*
|
||||
* sum_event_value and nb_events_with_value are calculated by the Event archiver.
|
||||
*/
|
||||
class AverageEventValue extends ProcessedMetric
|
||||
{
|
||||
public function getName()
|
||||
{
|
||||
return 'avg_event_value';
|
||||
}
|
||||
|
||||
public function getTranslatedName()
|
||||
{
|
||||
return Piwik::translate('Events_AvgValueDocumentation');
|
||||
}
|
||||
|
||||
public function compute(Row $row)
|
||||
{
|
||||
$sumEventValue = $this->getMetric($row, 'sum_event_value');
|
||||
$eventsWithValue = $this->getMetric($row, 'nb_events_with_value');
|
||||
|
||||
return Piwik::getQuotientSafe($sumEventValue, $eventsWithValue, $precision = 2);
|
||||
}
|
||||
|
||||
public function getDependentMetrics()
|
||||
{
|
||||
return array('sum_event_value', 'nb_events_with_value');
|
||||
}
|
||||
}
|
||||
77
www/analytics/plugins/Events/Columns/TotalEvents.php
Normal file
77
www/analytics/plugins/Events/Columns/TotalEvents.php
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Events\Columns;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\Dimension\VisitDimension;
|
||||
use Piwik\Plugin\Segment;
|
||||
use Piwik\Tracker\Action;
|
||||
use Piwik\Tracker\Request;
|
||||
use Piwik\Tracker\Visitor;
|
||||
|
||||
class TotalEvents extends VisitDimension
|
||||
{
|
||||
protected $columnName = 'visit_total_events';
|
||||
protected $columnType = 'SMALLINT(5) UNSIGNED NOT NULL';
|
||||
|
||||
protected function configureSegments()
|
||||
{
|
||||
$segment = new Segment();
|
||||
$segment->setSegment('events');
|
||||
$segment->setName('Events_TotalEvents');
|
||||
$segment->setAcceptedValues('To select all visits who triggered an Event, use: &segment=events>0');
|
||||
$segment->setCategory('General_Visit');
|
||||
$segment->setType(Segment::TYPE_METRIC);
|
||||
$this->addSegment($segment);
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return Piwik::translate('Events_EventName');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @return mixed
|
||||
*/
|
||||
public function onNewVisit(Request $request, Visitor $visitor, $action)
|
||||
{
|
||||
if ($this->isEventAction($action)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Visitor $visitor
|
||||
* @param Action|null $action
|
||||
* @return int
|
||||
*/
|
||||
public function onExistingVisit(Request $request, Visitor $visitor, $action)
|
||||
{
|
||||
if ($this->isEventAction($action)) {
|
||||
return 'visit_total_events + 1';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Action|null $action
|
||||
* @return bool
|
||||
*/
|
||||
private function isEventAction($action)
|
||||
{
|
||||
return ($action && $action->getActionType() == Action::TYPE_EVENT);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -8,10 +8,7 @@
|
|||
*/
|
||||
namespace Piwik\Plugins\Events;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugins\Events\Events;
|
||||
use Piwik\View;
|
||||
use Piwik\ViewDataTable\Factory;
|
||||
|
||||
/**
|
||||
* Events controller
|
||||
|
|
@ -56,21 +53,6 @@ class Controller extends \Piwik\Plugin\Controller
|
|||
return $this->indexEvent(__FUNCTION__);
|
||||
}
|
||||
|
||||
public function getCategory()
|
||||
{
|
||||
return $this->renderReport(__FUNCTION__);
|
||||
}
|
||||
|
||||
public function getAction()
|
||||
{
|
||||
return $this->renderReport(__FUNCTION__);
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->renderReport(__FUNCTION__);
|
||||
}
|
||||
|
||||
public function getActionFromCategoryId()
|
||||
{
|
||||
return $this->renderReport(__FUNCTION__);
|
||||
|
|
@ -107,9 +89,16 @@ class Controller extends \Piwik\Plugin\Controller
|
|||
$apiMethod = str_replace('index', 'get', $controllerMethod, $count);
|
||||
$events = new Events;
|
||||
$title = $events->getReportTitleTranslation($apiMethod);
|
||||
|
||||
if (method_exists($this, $apiMethod)) {
|
||||
$content = $this->$apiMethod();
|
||||
} else {
|
||||
$content = $this->renderReport($apiMethod);
|
||||
}
|
||||
|
||||
return View::singleReport(
|
||||
$title,
|
||||
$this->$apiMethod()
|
||||
$content
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Events\DataTable\Filter;
|
||||
|
||||
use Piwik\DataTable\BaseFilter;
|
||||
use Piwik\DataTable\Row;
|
||||
use Piwik\DataTable;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugins\Events\Archiver;
|
||||
|
||||
class ReplaceEventNameNotSet extends BaseFilter
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param DataTable $table The table to eventually filter.
|
||||
*/
|
||||
public function __construct($table)
|
||||
{
|
||||
parent::__construct($table);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DataTable $table
|
||||
*/
|
||||
public function filter($table)
|
||||
{
|
||||
$row = $table->getRowFromLabel(Archiver::EVENT_NAME_NOT_SET);
|
||||
if ($row) {
|
||||
$row->setColumn('label', Piwik::translate('General_NotDefined', Piwik::translate('Events_EventName')));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -9,43 +9,31 @@
|
|||
namespace Piwik\Plugins\Events;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Menu\MenuMain;
|
||||
use Piwik\DataTable;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\Report;
|
||||
use Piwik\Plugin\ViewDataTable;
|
||||
use Piwik\WidgetsList;
|
||||
use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable\AllColumns;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Events extends \Piwik\Plugin
|
||||
{
|
||||
/**
|
||||
* @see Piwik\Plugin::getListHooksRegistered
|
||||
* @see Piwik\Plugin::registerEvents
|
||||
*/
|
||||
public function getListHooksRegistered()
|
||||
public function registerEvents()
|
||||
{
|
||||
return array(
|
||||
'API.getSegmentDimensionMetadata' => 'getSegmentsMetadata',
|
||||
'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations',
|
||||
'API.getReportMetadata' => 'getReportMetadata',
|
||||
'Menu.Reporting.addItems' => 'addMenus',
|
||||
'WidgetsList.addWidgets' => 'addWidgets',
|
||||
'ViewDataTable.configure' => 'configureViewDataTable',
|
||||
|
||||
'Metrics.getDefaultMetricDocumentationTranslations' => 'addMetricDocumentationTranslations',
|
||||
'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations',
|
||||
'ViewDataTable.configure' => 'configureViewDataTable',
|
||||
'Live.getAllVisitorDetails' => 'extendVisitorDetails',
|
||||
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
|
||||
);
|
||||
}
|
||||
public function addWidgets()
|
||||
{
|
||||
foreach(self::getLabelTranslations() as $apiMethod => $labels) {
|
||||
$params = array(
|
||||
'secondaryDimension' => API::getInstance()->getDefaultSecondaryDimension($apiMethod)
|
||||
);
|
||||
WidgetsList::add('Events_Events', $labels[0], 'Events', $apiMethod, $params);
|
||||
}
|
||||
}
|
||||
|
||||
public function addMenus()
|
||||
public function extendVisitorDetails(&$visitor, $details)
|
||||
{
|
||||
MenuMain::getInstance()->add('General_Actions', 'Events_Events', array('module' => 'Events', 'action' => 'index'), true, 30);
|
||||
$visitor['events'] = $details['visit_total_events'];
|
||||
}
|
||||
|
||||
public function addMetricTranslations(&$translations)
|
||||
|
|
@ -53,6 +41,11 @@ class Events extends \Piwik\Plugin
|
|||
$translations = array_merge($translations, $this->getMetricTranslations());
|
||||
}
|
||||
|
||||
public function addMetricDocumentationTranslations(&$translations)
|
||||
{
|
||||
$translations = array_merge($translations, $this->getMetricDocumentation());
|
||||
}
|
||||
|
||||
public function getMetricDocumentation()
|
||||
{
|
||||
$documentation = array(
|
||||
|
|
@ -94,7 +87,7 @@ class Events extends \Piwik\Plugin
|
|||
/**
|
||||
* @return array
|
||||
*/
|
||||
static public function getLabelTranslations()
|
||||
public static function getLabelTranslations()
|
||||
{
|
||||
return array(
|
||||
'getCategory' => array('Events_EventCategories', 'Events_EventCategory'),
|
||||
|
|
@ -103,77 +96,6 @@ class Events extends \Piwik\Plugin
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
public function getSegmentsMetadata(&$segments)
|
||||
{
|
||||
$sqlFilter = '\\Piwik\\Tracker\\TableLogAction::getIdActionFromSegment';
|
||||
|
||||
foreach($this->metadataDimensions as $dimension => $metadata) {
|
||||
$segments[] = array(
|
||||
'type' => 'dimension',
|
||||
'category' => 'Events_Events',
|
||||
'name' => $metadata[0],
|
||||
'segment' => $dimension,
|
||||
'sqlSegment' => $metadata[1],
|
||||
'sqlFilter' => $sqlFilter,
|
||||
);
|
||||
}
|
||||
$segments[] = array(
|
||||
'type' => 'metric',
|
||||
'category' => Piwik::translate('General_Visit'),
|
||||
'name' => 'Events_TotalEvents',
|
||||
'segment' => 'events',
|
||||
'sqlSegment' => 'log_visit.visit_total_events',
|
||||
'acceptedValues' => 'To select all visits who triggered an Event, use: &segment=events>0',
|
||||
);
|
||||
// $segments[] = array(
|
||||
// 'type' => 'metric',
|
||||
// 'category' => 'Events_Events',
|
||||
// 'name' => 'Events_EventValue',
|
||||
// 'segment' => 'eventValue',
|
||||
// 'sqlSegment' => 'log_link_visit_action.custom_float',
|
||||
// 'sqlFilter' => '\\Piwik\\Plugins\\Events\\Events::getSegmentEventValue'
|
||||
// );
|
||||
}
|
||||
//
|
||||
// public static function getSegmentEventValue($valueToMatch, $sqlField, $matchType, $segmentName)
|
||||
// {
|
||||
// $andActionisNotEvent = \Piwik\Plugins\Actions\Archiver::getWhereClauseActionIsNotEvent();
|
||||
// $andActionisEvent = str_replace("IS NULL", "IS NOT NULL", $andActionisNotEvent);
|
||||
//
|
||||
// return array(
|
||||
// 'extraWhere' => $andActionisEvent,
|
||||
// 'bind' => $valueToMatch
|
||||
// );
|
||||
// }
|
||||
|
||||
public function getReportMetadata(&$reports)
|
||||
{
|
||||
$metrics = $this->getMetricTranslations();
|
||||
$documentation = $this->getMetricDocumentation();
|
||||
$labelTranslations = $this->getLabelTranslations();
|
||||
|
||||
$order = 0;
|
||||
foreach($labelTranslations as $action => $translations) {
|
||||
$secondaryDimension = $this->getSecondaryDimensionFromRequest();
|
||||
$actionToLoadSubtables = API::getInstance()->getActionToLoadSubtables($action, $secondaryDimension);
|
||||
$reports[] = array(
|
||||
'category' => Piwik::translate('Events_Events'),
|
||||
'name' => Piwik::translate($translations[0]),
|
||||
'module' => 'Events',
|
||||
'action' => $action,
|
||||
'dimension' => Piwik::translate($translations[1]),
|
||||
'metrics' => $metrics,
|
||||
'metricsDocumentation' => $documentation,
|
||||
'processedMetrics' => false,
|
||||
'actionToLoadSubTables' => $actionToLoadSubtables,
|
||||
'order' => $order++
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given getCategory, returns "Event Categories"
|
||||
*
|
||||
|
|
@ -211,7 +133,7 @@ class Events extends \Piwik\Plugin
|
|||
|
||||
public function configureViewDataTable(ViewDataTable $view)
|
||||
{
|
||||
if($view->requestConfig->getApiModuleToRequest() != 'Events') {
|
||||
if ($view->requestConfig->getApiModuleToRequest() != 'Events') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -220,30 +142,60 @@ class Events extends \Piwik\Plugin
|
|||
|
||||
$secondaryDimension = $this->getSecondaryDimensionFromRequest();
|
||||
$view->config->subtable_controller_action = API::getInstance()->getActionToLoadSubtables($apiMethod, $secondaryDimension);
|
||||
$view->config->columns_to_display = array('label', 'nb_events', 'sum_event_value');
|
||||
|
||||
if (Common::getRequestVar('pivotBy', false) === false) {
|
||||
$view->config->columns_to_display = array('label', 'nb_events', 'sum_event_value');
|
||||
}
|
||||
|
||||
$view->config->show_flatten_table = true;
|
||||
$view->config->show_table_all_columns = false;
|
||||
$view->requestConfig->filter_sort_column = 'nb_events';
|
||||
|
||||
if ($view->isViewDataTableId(AllColumns::ID)) {
|
||||
$view->config->filters[] = function (DataTable $table) use ($view) {
|
||||
$columsToDisplay = array('label');
|
||||
|
||||
$columns = $table->getColumns();
|
||||
if (in_array('nb_visits', $columns)) {
|
||||
$columsToDisplay[] = 'nb_visits';
|
||||
}
|
||||
|
||||
if (in_array('nb_uniq_visitors', $columns)) {
|
||||
$columsToDisplay[] = 'nb_uniq_visitors';
|
||||
}
|
||||
|
||||
$view->config->columns_to_display = array_merge($columsToDisplay, array('nb_events', 'sum_event_value', 'avg_event_value', 'min_event_value', 'max_event_value'));
|
||||
|
||||
if (!in_array($view->requestConfig->filter_sort_column, $view->config->columns_to_display)) {
|
||||
$view->requestConfig->filter_sort_column = 'nb_events';
|
||||
}
|
||||
};
|
||||
$view->config->show_pivot_by_subtable = false;
|
||||
}
|
||||
|
||||
$labelTranslation = $this->getColumnTranslation($apiMethod);
|
||||
$view->config->addTranslation('label', $labelTranslation);
|
||||
$view->config->addTranslations($this->getMetricTranslations());
|
||||
$this->addRelatedReports($view, $secondaryDimension);
|
||||
$this->addTooltipEventValue($view);
|
||||
|
||||
$subtableReport = Report::factory('Events', $view->config->subtable_controller_action);
|
||||
$view->config->pivot_by_dimension = $subtableReport->getDimension()->getId();
|
||||
$view->config->pivot_by_column = 'nb_events';
|
||||
}
|
||||
|
||||
protected function addRelatedReports($view, $secondaryDimension)
|
||||
private function addRelatedReports($view, $secondaryDimension)
|
||||
{
|
||||
if(empty($secondaryDimension)) {
|
||||
if (empty($secondaryDimension)) {
|
||||
// eg. Row Evolution
|
||||
return;
|
||||
}
|
||||
|
||||
$view->config->show_related_reports = true;
|
||||
|
||||
$apiMethod = $view->requestConfig->getApiMethodToRequest();
|
||||
$secondaryDimensions = API::getInstance()->getSecondaryDimensions($apiMethod);
|
||||
|
||||
if(empty($secondaryDimensions)) {
|
||||
if (empty($secondaryDimensions)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -254,7 +206,7 @@ class Events extends \Piwik\Plugin
|
|||
. Piwik::translate('Events_SwitchToSecondaryDimension', '');
|
||||
|
||||
foreach($secondaryDimensions as $dimension) {
|
||||
if($dimension == $secondaryDimension) {
|
||||
if ($dimension == $secondaryDimension) {
|
||||
// don't show as related report the currently selected dimension
|
||||
continue;
|
||||
}
|
||||
|
|
@ -269,13 +221,16 @@ class Events extends \Piwik\Plugin
|
|||
|
||||
}
|
||||
|
||||
protected function addTooltipEventValue($view)
|
||||
private function addTooltipEventValue(ViewDataTable $view)
|
||||
{
|
||||
// Creates the tooltip message for Event Value column
|
||||
$tooltipCallback = function ($hits, $min, $max, $avg) {
|
||||
if (!$hits) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$avg = $avg ?: 0;
|
||||
|
||||
$msgEventMinMax = Piwik::translate("Events_EventValueTooltip", array($hits, "<br />", $min, $max));
|
||||
$msgEventAvg = Piwik::translate("Events_AvgEventValue", $avg);
|
||||
return $msgEventMinMax . "<br/>" . $msgEventAvg;
|
||||
|
|
@ -283,24 +238,29 @@ class Events extends \Piwik\Plugin
|
|||
|
||||
// Add tooltip metadata column to the DataTable
|
||||
$view->config->filters[] = array('ColumnCallbackAddMetadata',
|
||||
array(
|
||||
array(
|
||||
'nb_events',
|
||||
'min_event_value',
|
||||
'max_event_value',
|
||||
'avg_event_value'
|
||||
),
|
||||
'sum_event_value_tooltip',
|
||||
$tooltipCallback
|
||||
)
|
||||
array(
|
||||
array(
|
||||
'nb_events',
|
||||
'min_event_value',
|
||||
'max_event_value',
|
||||
'avg_event_value'
|
||||
),
|
||||
'sum_event_value_tooltip',
|
||||
$tooltipCallback
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getSecondaryDimensionFromRequest()
|
||||
public function getSecondaryDimensionFromRequest()
|
||||
{
|
||||
return Common::getRequestVar('secondaryDimension', false, 'string');
|
||||
}
|
||||
|
||||
public function getStylesheetFiles(&$stylesheets)
|
||||
{
|
||||
$stylesheets[] = "plugins/Events/stylesheets/datatable.less";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
21
www/analytics/plugins/Events/Menu.php
Normal file
21
www/analytics/plugins/Events/Menu.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Events;
|
||||
|
||||
use Piwik\Menu\MenuReporting;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Menu extends \Piwik\Plugin\Menu
|
||||
{
|
||||
public function configureReportingMenu(MenuReporting $menu)
|
||||
{
|
||||
$menu->addActionsItem('Events_Events', $this->urlForAction('index'), 30);
|
||||
}
|
||||
}
|
||||
28
www/analytics/plugins/Events/Reports/Base.php
Normal file
28
www/analytics/plugins/Events/Reports/Base.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Events\Reports;
|
||||
|
||||
use Piwik\Plugins\Events\API;
|
||||
use Piwik\Plugins\Events\Columns\Metrics\AverageEventValue;
|
||||
|
||||
abstract class Base extends \Piwik\Plugin\Report
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
$this->category = 'Events_Events';
|
||||
$this->processedMetrics = array(
|
||||
new AverageEventValue()
|
||||
);
|
||||
|
||||
$this->widgetParams = array(
|
||||
'secondaryDimension' => API::getInstance()->getDefaultSecondaryDimension($this->action)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
32
www/analytics/plugins/Events/Reports/GetAction.php
Normal file
32
www/analytics/plugins/Events/Reports/GetAction.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Events\Reports;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugins\Events\Columns\EventAction;
|
||||
|
||||
class GetAction extends Base
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
$this->dimension = new EventAction();
|
||||
$this->name = Piwik::translate('Events_EventActions');
|
||||
$this->documentation = ''; // TODO
|
||||
$this->metrics = array('nb_events', 'sum_event_value', 'min_event_value', 'max_event_value', 'nb_events_with_value');
|
||||
if (Common::getRequestVar('secondaryDimension', false) == 'eventCategory') {
|
||||
$this->actionToLoadSubTables = 'getCategoryFromNameId';
|
||||
} else {
|
||||
$this->actionToLoadSubTables = 'getNameFromActionId';
|
||||
}
|
||||
$this->order = 1;
|
||||
$this->widgetTitle = 'Events_EventActions';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Events\Reports;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\Report;
|
||||
use Piwik\Plugins\Events\Columns\EventAction;
|
||||
|
||||
/**
|
||||
* Report metadata class for the Events.getActionFromCategoryId class.
|
||||
*/
|
||||
class GetActionFromCategoryId extends Base
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->dimension = new EventAction();
|
||||
$this->name = Piwik::translate('Events_EventActions');
|
||||
$this->isSubtableReport = true;
|
||||
$this->widgetParams = array();
|
||||
}
|
||||
}
|
||||
29
www/analytics/plugins/Events/Reports/GetActionFromNameId.php
Normal file
29
www/analytics/plugins/Events/Reports/GetActionFromNameId.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Events\Reports;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\Report;
|
||||
use Piwik\Plugins\Events\Columns\EventAction;
|
||||
|
||||
/**
|
||||
* Report metadata class for the Events.getActionFromNameId class.
|
||||
*/
|
||||
class GetActionFromNameId extends Base
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->dimension = new EventAction();
|
||||
$this->name = Piwik::translate('Events_EventActions');
|
||||
$this->isSubtableReport = true;
|
||||
$this->widgetParams = array();
|
||||
}
|
||||
}
|
||||
32
www/analytics/plugins/Events/Reports/GetCategory.php
Normal file
32
www/analytics/plugins/Events/Reports/GetCategory.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Events\Reports;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugins\Events\Columns\EventCategory;
|
||||
|
||||
class GetCategory extends Base
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
$this->dimension = new EventCategory();
|
||||
$this->name = Piwik::translate('Events_EventCategories');
|
||||
$this->documentation = ''; // TODO
|
||||
$this->metrics = array('nb_events', 'sum_event_value', 'min_event_value', 'max_event_value', 'nb_events_with_value');
|
||||
if (Common::getRequestVar('secondaryDimension', false) == 'eventName') {
|
||||
$this->actionToLoadSubTables = 'getNameFromCategoryId';
|
||||
} else {
|
||||
$this->actionToLoadSubTables = 'getActionFromCategoryId';
|
||||
}
|
||||
$this->order = 0;
|
||||
$this->widgetTitle = 'Events_EventCategories';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Events\Reports;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\Report;
|
||||
use Piwik\Plugins\Events\Columns\EventCategory;
|
||||
|
||||
/**
|
||||
* Report metadata class for the Events.getCategoryFromActionId class.
|
||||
*/
|
||||
class GetCategoryFromActionId extends Base
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->dimension = new EventCategory();
|
||||
$this->name = Piwik::translate('Events_EventCategories');
|
||||
$this->isSubtableReport = true;
|
||||
$this->widgetParams = array();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Events\Reports;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\Report;
|
||||
use Piwik\Plugins\Events\Columns\EventCategory;
|
||||
|
||||
/**
|
||||
* Report metadata class for the Events.getCategoryFromNameId class.
|
||||
*/
|
||||
class GetCategoryFromNameId extends Base
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->dimension = new EventCategory();
|
||||
$this->name = Piwik::translate('Events_EventCategories');
|
||||
$this->isSubtableReport = true;
|
||||
$this->widgetParams = array();
|
||||
}
|
||||
}
|
||||
32
www/analytics/plugins/Events/Reports/GetName.php
Normal file
32
www/analytics/plugins/Events/Reports/GetName.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Events\Reports;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugins\Events\Columns\EventName;
|
||||
|
||||
class GetName extends Base
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
$this->dimension = new EventName();
|
||||
$this->name = Piwik::translate('Events_EventNames');
|
||||
$this->documentation = ''; // TODO
|
||||
$this->metrics = array('nb_events', 'sum_event_value', 'min_event_value', 'max_event_value', 'nb_events_with_value');
|
||||
if (Common::getRequestVar('secondaryDimension', false) == 'eventCategory') {
|
||||
$this->actionToLoadSubTables = 'getCategoryFromNameId';
|
||||
} else {
|
||||
$this->actionToLoadSubTables = 'getActionFromNameId';
|
||||
}
|
||||
$this->order = 2;
|
||||
$this->widgetTitle = 'Events_EventNames';
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue