diff options
Diffstat (limited to 'plugins/Goals/Tracker/GoalsRequestProcessor.php')
-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 + ); + } } } |