diff options
author | Stefan Giehl <stefan@piwik.org> | 2017-09-15 00:54:01 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2017-09-15 00:54:01 +0300 |
commit | 40f886baf0e3ce5bbe4a066b333a7cc24eb93163 (patch) | |
tree | 93418e061ccf95d86383504d4c778b305aee8792 /plugins/Events | |
parent | 595da1313efd43a0a60c1797364da42511d46de6 (diff) |
Makes visitor log/profile independent from Events plugin (#12047)
* makes profile query independent from events plugin
* move more stuff to event plugin
* update test files
Diffstat (limited to 'plugins/Events')
-rw-r--r-- | plugins/Events/Events.php | 1 | ||||
-rw-r--r-- | plugins/Events/VisitorDetails.php | 20 |
2 files changed, 20 insertions, 1 deletions
diff --git a/plugins/Events/Events.php b/plugins/Events/Events.php index eee4ce7f52..d3fc8501f1 100644 --- a/plugins/Events/Events.php +++ b/plugins/Events/Events.php @@ -263,6 +263,7 @@ class Events extends \Piwik\Plugin public function provideActionDimensionFields(&$fields, &$joins) { + $fields[] = 'log_action_event_category.type AS eventType'; $fields[] = 'log_action_event_category.name AS eventCategory'; $fields[] = 'log_action_event_action.name as eventAction'; $joins[] = 'LEFT JOIN ' . Common::prefixTable('log_action') . ' AS log_action_event_action diff --git a/plugins/Events/VisitorDetails.php b/plugins/Events/VisitorDetails.php index 76dfd37806..ecf76847d8 100644 --- a/plugins/Events/VisitorDetails.php +++ b/plugins/Events/VisitorDetails.php @@ -6,6 +6,7 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later * */ + namespace Piwik\Plugins\Events; use Piwik\Plugins\Live\VisitorDetailsAbstract; @@ -14,12 +15,29 @@ use Piwik\View; class VisitorDetails extends VisitorDetailsAbstract { + const EVENT_VALUE_PRECISION = 3; + public function extendActionDetails(&$action, $nextAction, $visitorDetails) { - if ($action['type'] == Action::TYPE_EVENT) { + if (!empty($action['eventType'])) { $action['type'] = 'event'; $action['icon'] = 'plugins/Morpheus/images/event.png'; + + if (strlen($action['pageTitle']) > 0) { + $action['eventName'] = $action['pageTitle']; + } + + if (isset($action['custom_float']) && strlen($action['custom_float']) > 0) { + $action['eventValue'] = round($action['custom_float'], self::EVENT_VALUE_PRECISION); + } + + unset($action['pageTitle']); + unset($action['custom_float']); + } else { + unset($action['eventCategory']); + unset($action['eventAction']); } + unset($action['eventType']); } public function extendVisitorDetails(&$visitor) |