diff options
author | Stefan Giehl <stefan@matomo.org> | 2019-11-11 21:49:11 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2019-11-11 21:49:11 +0300 |
commit | c93bd45479d830631d82b90839296d0d1b485737 (patch) | |
tree | a4a550bdf26c328567320f6e5248bfc9cdd70f0f /core/Metrics.php | |
parent | 47faa815a50ae48c969cd8e5e455769e4ddb104b (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.php | 23 |
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' ); |