diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Goals/Tracker/GoalsRequestProcessor.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/plugins/Goals/Tracker/GoalsRequestProcessor.php b/plugins/Goals/Tracker/GoalsRequestProcessor.php index 22315f7511..2bde947928 100644 --- a/plugins/Goals/Tracker/GoalsRequestProcessor.php +++ b/plugins/Goals/Tracker/GoalsRequestProcessor.php @@ -70,4 +70,26 @@ class GoalsRequestProcessor extends RequestProcessor $visitProperties->setRequestMetadata('Goals', 'visitIsConverted', $someGoalsConverted); } } + + public function processRequest(VisitProperties $visitProperties) + { + $isManualGoalConversion = self::$goalManager->isManualGoalConversion(); + $requestIsEcommerce = self::$goalManager->requestIsEcommerce; + + $visitorNotFoundInDb = $visitProperties->getRequestMetadata('CoreHome', 'visitorNotFoundInDb'); + + // There is an edge case when: + // - two manual goal conversions happen in the same second + // - which result in handleExistingVisit throwing the exception + // because the UPDATE didn't affect any rows (one row was found, but not updated since no field changed) + // - the exception is caught here and will result in a new visit incorrectly + // In this case, we cancel the current conversion to be recorded: + if ($visitorNotFoundInDb + && ($isManualGoalConversion + || $requestIsEcommerce) + ) { + $visitProperties->setRequestMetadata('Goals', 'someGoalsConverted', false); + $visitProperties->setRequestMetadata('Goals', 'visitIsConverted', false); + } + } } |