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:
authorStefan Giehl <stefan@matomo.org>2019-11-11 21:49:11 +0300
committerThomas Steur <tsteur@users.noreply.github.com>2019-11-11 21:49:11 +0300
commitc93bd45479d830631d82b90839296d0d1b485737 (patch)
treea4a550bdf26c328567320f6e5248bfc9cdd70f0f /core/Metrics.php
parent47faa815a50ae48c969cd8e5e455769e4ddb104b (diff)
Adds new event to define if lower metric values are better (#15147)
* Adds new event to define if lower metric values are better * updates CHANGELOG
Diffstat (limited to 'core/Metrics.php')
-rw-r--r--core/Metrics.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/core/Metrics.php b/core/Metrics.php
index 144e0ec291..63a04dfc8b 100644
--- a/core/Metrics.php
+++ b/core/Metrics.php
@@ -245,6 +245,29 @@ class Metrics
*/
public static function isLowerValueBetter($column)
{
+ $isLowerBetter = null;
+
+ /**
+ * Use this event to define if a lower value of a metric is better.
+ *
+ * @param string $isLowerBetter should be set to a boolean indicating if lower is better
+ * @param string $column name of the column to determine
+ *
+ * **Example**
+ *
+ * public function checkIsLowerMetricValueBetter(&$isLowerBetter, $metric)
+ * {
+ * if ($metric === 'position') {
+ * $isLowerBetter = true;
+ * }
+ * }
+ */
+ Piwik::postEvent('Metrics.isLowerValueBetter', [&$isLowerBetter, $column]);
+
+ if (!is_null($isLowerBetter)) {
+ return true;
+ }
+
$lowerIsBetterPatterns = array(
'bounce', 'exit'
);