Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2017-10-03 23:22:01 +0300
committerGitHub <noreply@github.com>2017-10-03 23:22:01 +0300
commit9af4e95aa976f3a6533e95b776b5298f73e5f916 (patch)
treed612cd4d32019e9e52ce1398b8bf214ec06a8e0f /plugins/Events
parent359c3ec875b554c7b71a933b26d18cdde0bb8f4e (diff)
Better segment editor and fixes (#12040)
* column tweak * fix install * more tweaks * rename column to dimension * various fixes * added new control expandable select * starting to refactor segment selector * make segment editor work again * use translation keys * defined some metrics * set types * simplify * simplify * fix join generator * add possibility to use custom join table names when using query builder and it uses an inner query * fix bug in query selector when selecting same field name from different tables twice * more metadata * more tweaks * improve selector * add possibility to use custom entity names * also processed archived metrics * generate sql filter, suggested values callback, and accept values automatically for columns with enums * several tweaks * focus search field when opening it * various tweaks * added missing method * format and fix more metadata * more fixes * better definition * define custom filter * fix definition * fix various tests * fix more tests * fix bug in logquery builder * fix referrerurl segment was missing * fix some tests * fix more tests * add group * refactor for better definition * fix a bug in log query builder when similar columns are used in archiver * add goal metrics * various fixes * make datatable row more flexible * various fixes and visualization enhancements * simply segment editor and make it smaller * remove trailing comma * various fixes and added new dimension * fix formatting of returning customer * added missing primary key * fixes * various fixes and improvements * make sure to update segment definition when selecting a value from auto complete list * various fixes and more metrics * more metrics * more dimensions and fixes * fix some tests * fix some integration tests * update submodule * fix some system tests * fix ui tests * trigger new test run * fix more ui tests * fix system tests * update submodule * fix categories * sort segments by category for more consistency * add custom variables * some translations and fixes * add minute segment * more segments * added plurals * added some docs * fix test * fix tests * fix tests * added suggested values * fix some tests * various fixes * fix more tests * allow to select segments on any site * make sure to include file * added doc block * fix some system tests * fix most system tests * fix ui test * fix system test * adjust examples * added more tests and docs * no metrics for these dimensions * added developer changelog and made some classes public api * some fixes for entity names * add possibility to set format metrics in test * more consistency in defining the name * get idsites only if provided * fix integration tests * added another segment for visit start hour and visit start minute * more clear name for segment * use old segment name to not break bc * various fixes * more test fixes * fix no suggested values for new segment * add event value * for boolean dimensions only sum metric * update available widgets when updating reporting menu * Add new segments in developer changelog + typo * fix system tests * fix screenshot test
Diffstat (limited to 'plugins/Events')
-rw-r--r--plugins/Events/Categories/EventsCategory.php19
-rw-r--r--plugins/Events/Columns/EventAction.php23
-rw-r--r--plugins/Events/Columns/EventCategory.php23
-rw-r--r--plugins/Events/Columns/EventName.php23
-rw-r--r--plugins/Events/Columns/EventValue.php56
-rw-r--r--plugins/Events/Columns/TotalEvents.php21
-rw-r--r--plugins/Events/Segment.php22
7 files changed, 118 insertions, 69 deletions
diff --git a/plugins/Events/Categories/EventsCategory.php b/plugins/Events/Categories/EventsCategory.php
new file mode 100644
index 0000000000..3e82e4887c
--- /dev/null
+++ b/plugins/Events/Categories/EventsCategory.php
@@ -0,0 +1,19 @@
+<?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\Categories;
+
+use Piwik\Category\Category;
+
+// Needed for dimensions and metrics
+class EventsCategory extends Category
+{
+ protected $id = 'Events_Events';
+ protected $order = 12;
+
+}
diff --git a/plugins/Events/Columns/EventAction.php b/plugins/Events/Columns/EventAction.php
index 30c33fe8da..e08325e0b7 100644
--- a/plugins/Events/Columns/EventAction.php
+++ b/plugins/Events/Columns/EventAction.php
@@ -8,10 +8,10 @@
*/
namespace Piwik\Plugins\Events\Columns;
+use Piwik\Columns\Discriminator;
+use Piwik\Columns\Join\ActionNameJoin;
use Piwik\Exception\InvalidRequestParameterException;
-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;
@@ -20,18 +20,21 @@ class EventAction extends ActionDimension
{
protected $columnName = 'idaction_event_action';
protected $columnType = 'INTEGER(10) UNSIGNED DEFAULT NULL';
-
- protected function configureSegments()
+ protected $type = self::TYPE_TEXT;
+ protected $segmentName = 'eventAction';
+ protected $nameSingular = 'Events_EventAction';
+ protected $namePlural = 'Events_EventActions';
+ protected $category = 'Events_Events';
+ protected $sqlFilter = '\Piwik\Tracker\TableLogAction::getIdActionFromSegment';
+
+ public function getDbColumnJoin()
{
- $segment = new Segment();
- $segment->setSegment('eventAction');
- $segment->setName('Events_EventAction');
- $this->addSegment($segment);
+ return new ActionNameJoin();
}
- public function getName()
+ public function getDbDiscriminator()
{
- return Piwik::translate('Events_EventAction');
+ return new Discriminator('log_action', 'type', $this->getActionId());
}
public function getActionId()
diff --git a/plugins/Events/Columns/EventCategory.php b/plugins/Events/Columns/EventCategory.php
index 731dd9615c..b10b1a8406 100644
--- a/plugins/Events/Columns/EventCategory.php
+++ b/plugins/Events/Columns/EventCategory.php
@@ -8,10 +8,10 @@
*/
namespace Piwik\Plugins\Events\Columns;
+use Piwik\Columns\Discriminator;
+use Piwik\Columns\Join\ActionNameJoin;
use Piwik\Exception\InvalidRequestParameterException;
-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;
@@ -20,18 +20,21 @@ class EventCategory extends ActionDimension
{
protected $columnName = 'idaction_event_category';
protected $columnType = 'INTEGER(10) UNSIGNED DEFAULT NULL';
-
- protected function configureSegments()
+ protected $type = self::TYPE_TEXT;
+ protected $category = 'Events_Events';
+ protected $sqlFilter = '\Piwik\Tracker\TableLogAction::getIdActionFromSegment';
+ protected $segmentName = 'eventCategory';
+ protected $nameSingular = 'Events_EventCategory';
+ protected $namePlural = 'Events_EventCategories';
+
+ public function getDbColumnJoin()
{
- $segment = new Segment();
- $segment->setSegment('eventCategory');
- $segment->setName('Events_EventCategory');
- $this->addSegment($segment);
+ return new ActionNameJoin();
}
- public function getName()
+ public function getDbDiscriminator()
{
- return Piwik::translate('Events_EventCategory');
+ return new Discriminator('log_action', 'type', $this->getActionId());
}
public function getActionId()
diff --git a/plugins/Events/Columns/EventName.php b/plugins/Events/Columns/EventName.php
index bbe01ae0ff..71876dfc28 100644
--- a/plugins/Events/Columns/EventName.php
+++ b/plugins/Events/Columns/EventName.php
@@ -8,9 +8,9 @@
*/
namespace Piwik\Plugins\Events\Columns;
-use Piwik\Piwik;
+use Piwik\Columns\Discriminator;
+use Piwik\Columns\Join\ActionNameJoin;
use Piwik\Plugin\Dimension\ActionDimension;
-use Piwik\Plugins\Events\Segment;
use Piwik\Plugins\Events\Actions\ActionEvent;
use Piwik\Tracker\Action;
use Piwik\Tracker\Request;
@@ -18,18 +18,21 @@ use Piwik\Tracker\Request;
class EventName extends ActionDimension
{
protected $columnName = 'idaction_name';
-
- protected function configureSegments()
+ protected $type = self::TYPE_TEXT;
+ protected $category = 'Events_Events';
+ protected $sqlFilter = '\Piwik\Tracker\TableLogAction::getIdActionFromSegment';
+ protected $segmentName = 'eventName';
+ protected $nameSingular = 'Events_EventName';
+ protected $namePlural = 'Events_EventNames';
+
+ public function getDbColumnJoin()
{
- $segment = new Segment();
- $segment->setSegment('eventName');
- $segment->setName('Events_EventName');
- $this->addSegment($segment);
+ return new ActionNameJoin();
}
- public function getName()
+ public function getDbDiscriminator()
{
- return Piwik::translate('Events_EventName');
+ return new Discriminator('log_action', 'type', $this->getActionId());
}
public function getActionId()
diff --git a/plugins/Events/Columns/EventValue.php b/plugins/Events/Columns/EventValue.php
new file mode 100644
index 0000000000..1a174553a0
--- /dev/null
+++ b/plugins/Events/Columns/EventValue.php
@@ -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\Columns\DimensionMetricFactory;
+use Piwik\Columns\Discriminator;
+use Piwik\Columns\MetricsList;
+use Piwik\Piwik;
+use Piwik\Plugin\ArchivedMetric;
+use Piwik\Plugin\ComputedMetric;
+use Piwik\Plugin\Dimension\ActionDimension;
+use Piwik\Tracker\Action;
+
+class EventValue extends ActionDimension
+{
+ protected $nameSingular = 'Events_EventValue';
+ protected $columnName = 'custom_float';
+ protected $category = 'Events_Events';
+ protected $type = self::TYPE_FLOAT;
+
+ public function getDbDiscriminator()
+ {
+ return new Discriminator('log_action', 'type', Action::TYPE_EVENT);
+ }
+
+ public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
+ {
+ $metric1 = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_SUM);
+ $metricsList->addMetric($metric1);
+
+ $metric2 = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_MAX);
+ $metric2->setDocumentation(Piwik::translate('Events_MaxValueDocumentation'));
+ $metricsList->addMetric($metric2);
+
+ $metric4 = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_MIN);
+ $metric4->setDocumentation(Piwik::translate('Events_MinValueDocumentation'));
+ $metricsList->addMetric($metric4);
+
+ $metric3 = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_COUNT_WITH_NUMERIC_VALUE);
+ $metric3->setName('events_with_event_value');
+ $metric3->setTranslatedName(Piwik::translate('Events_EventsWithValue'));
+ $metric3->setDocumentation(Piwik::translate('Events_EventsWithValueDocumentation'));
+ $metricsList->addMetric($metric3);
+
+ $metric = $dimensionMetricFactory->createComputedMetric($metric1->getName(), $metric3->getName(), ComputedMetric::AGGREGATION_AVG);
+ $metric->setName('avg_event_value');
+ $metric->setTranslatedName(Piwik::translate('Events_AvgValue'));
+ $metricsList->addMetric($metric);
+ }
+}
diff --git a/plugins/Events/Columns/TotalEvents.php b/plugins/Events/Columns/TotalEvents.php
index 410144e3a9..f96392c194 100644
--- a/plugins/Events/Columns/TotalEvents.php
+++ b/plugins/Events/Columns/TotalEvents.php
@@ -8,9 +8,7 @@
*/
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;
@@ -19,22 +17,11 @@ class TotalEvents extends VisitDimension
{
protected $columnName = 'visit_total_events';
protected $columnType = 'INT(11) UNSIGNED NULL';
+ protected $segmentName = 'events';
+ protected $nameSingular = 'Events_TotalEvents';
+ protected $acceptValues = 'To select all visits who triggered an Event, use: &segment=events>0';
- 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');
- }
+ protected $type = self::TYPE_NUMBER;
/**
* @param Request $request
diff --git a/plugins/Events/Segment.php b/plugins/Events/Segment.php
deleted file mode 100644
index aa586e3987..0000000000
--- a/plugins/Events/Segment.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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;
-
-/**
- * Events segment base class.
- *
- */
-class Segment extends \Piwik\Plugin\Segment
-{
- protected function init()
- {
- $this->setCategory('Events_Events');
- $this->setSqlFilter('\Piwik\Tracker\TableLogAction::getIdActionFromSegment');
- }
-}