diff options
author | diosmosis <benaka@piwik.pro> | 2015-07-09 08:03:42 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-08-06 17:37:58 +0300 |
commit | 5c284d7264a4e28e932a51b019c0679e42a95b0b (patch) | |
tree | caec532066f17a5b049c567c903d0cd3f58ab9e0 /plugins/Goals/Tracker | |
parent | 4b1b0757ff146837ec3ef8d928f37b04c1d17ac4 (diff) |
Move goals recording from Visit::handle() to GoalsRequestProcessor.
Diffstat (limited to 'plugins/Goals/Tracker')
-rw-r--r-- | plugins/Goals/Tracker/GoalsRequestProcessor.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/plugins/Goals/Tracker/GoalsRequestProcessor.php b/plugins/Goals/Tracker/GoalsRequestProcessor.php index 2bde947928..5e8132d2d3 100644 --- a/plugins/Goals/Tracker/GoalsRequestProcessor.php +++ b/plugins/Goals/Tracker/GoalsRequestProcessor.php @@ -14,6 +14,7 @@ use Piwik\Tracker\GoalManager; use Piwik\Tracker\Request; use Piwik\Tracker\RequestProcessor; use Piwik\Tracker\Visit\VisitProperties; +use Piwik\Tracker\Visitor; /** * TODO @@ -71,7 +72,7 @@ class GoalsRequestProcessor extends RequestProcessor } } - public function processRequest(VisitProperties $visitProperties) + public function processRequest(Visitor $visitor, VisitProperties $visitProperties) { $isManualGoalConversion = self::$goalManager->isManualGoalConversion(); $requestIsEcommerce = self::$goalManager->requestIsEcommerce; @@ -91,5 +92,17 @@ class GoalsRequestProcessor extends RequestProcessor $visitProperties->setRequestMetadata('Goals', 'someGoalsConverted', false); $visitProperties->setRequestMetadata('Goals', 'visitIsConverted', false); } + + // record the goals if there were conversions in this request (even if the visit itself was not converted) + if ($visitProperties->getRequestMetadata('Goals', 'someGoalsConverted')) { + $action = $visitProperties->getRequestMetadata('Actions', 'action'); + + self::$goalManager->recordGoals( + $visitor, + $visitProperties->visitorInfo, + $visitProperties->getRequestMetadata('CustomVariables', 'visitCustomVariables'), + $action + ); + } } } |