diff options
Diffstat (limited to 'plugins/Events/Actions/ActionEvent.php')
-rw-r--r-- | plugins/Events/Actions/ActionEvent.php | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/plugins/Events/Actions/ActionEvent.php b/plugins/Events/Actions/ActionEvent.php new file mode 100644 index 0000000000..50b07b9350 --- /dev/null +++ b/plugins/Events/Actions/ActionEvent.php @@ -0,0 +1,73 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @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 function shouldHandle() + { + $eventCategory = $this->request->getParam('e_c'); + $eventAction = $this->request->getParam('e_a'); + + return (strlen($eventCategory) > 0 && strlen($eventAction) > 0); + } + + public function getCustomFloatValue() + { + return $this->eventValue; + } + + protected function getActionsToLookup() + { + return array( + 'idaction_url' => $this->getUrlAndType() + ); + } + + // 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; + } +} |