diff options
author | diosmosis <benaka@piwik.pro> | 2015-08-06 15:41:26 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-08-07 17:15:43 +0300 |
commit | 161ec8593a9f52be9d758569f86ece29f7cca4b2 (patch) | |
tree | bee439b8a8c73046ad2b6f7c7c23a109cf59e762 /plugins/Goals | |
parent | 2f91d3c83a834b0e451d3e58fa246ef0a87740fb (diff) |
Moving request metadata from VisitProperties to Tracker\Request class.
Diffstat (limited to 'plugins/Goals')
-rw-r--r-- | plugins/Goals/Tracker/GoalsRequestProcessor.php | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/plugins/Goals/Tracker/GoalsRequestProcessor.php b/plugins/Goals/Tracker/GoalsRequestProcessor.php index 9d9e753921..85b4e1c809 100644 --- a/plugins/Goals/Tracker/GoalsRequestProcessor.php +++ b/plugins/Goals/Tracker/GoalsRequestProcessor.php @@ -59,12 +59,12 @@ class GoalsRequestProcessor extends RequestProcessor $goal = $this->goalManager->detectGoalId($request->getIdSite(), $request); $visitIsConverted = !empty($goal); - $visitProperties->setRequestMetadata('Goals', 'visitIsConverted', $visitIsConverted); + $request->setMetadata('Goals', 'visitIsConverted', $visitIsConverted); - $existingConvertedGoals = $visitProperties->getRequestMetadata('Goals', 'goalsConverted') ?: array(); - $visitProperties->setRequestMetadata('Goals', 'goalsConverted', array_merge($existingConvertedGoals, array($goal))); + $existingConvertedGoals = $request->getMetadata('Goals', 'goalsConverted') ?: array(); + $request->setMetadata('Goals', 'goalsConverted', array_merge($existingConvertedGoals, array($goal))); - $visitProperties->setRequestMetadata('Actions', 'action', null); // don't track actions when doing manual goal conversions + $request->setMetadata('Actions', 'action', null); // don't track actions when doing manual goal conversions // if we find a idgoal in the URL, but then the goal is not valid, this is most likely a fake request if (!$visitIsConverted) { @@ -79,10 +79,10 @@ class GoalsRequestProcessor extends RequestProcessor public function afterRequestProcessed(VisitProperties $visitProperties, Request $request) { - $goalsConverted = $visitProperties->getRequestMetadata('Goals', 'goalsConverted'); + $goalsConverted = $request->getMetadata('Goals', 'goalsConverted'); /** @var Action $action */ - $action = $visitProperties->getRequestMetadata('Actions', 'action'); + $action = $request->getMetadata('Actions', 'action'); // if the visit hasn't already been converted another way (ie, manual goal conversion or ecommerce conversion, // try to convert based on the action) @@ -91,11 +91,11 @@ class GoalsRequestProcessor extends RequestProcessor ) { $goalsConverted = $this->goalManager->detectGoalsMatchingUrl($request->getIdSite(), $action); - $existingGoalsConverted = $visitProperties->getRequestMetadata('Goals', 'goalsConverted') ?: array(); - $visitProperties->setRequestMetadata('Goals', 'goalsConverted', array_merge($existingGoalsConverted, $goalsConverted)); + $existingGoalsConverted = $request->getMetadata('Goals', 'goalsConverted') ?: array(); + $request->setMetadata('Goals', 'goalsConverted', array_merge($existingGoalsConverted, $goalsConverted)); if (!empty($goalsConverted)) { - $visitProperties->setRequestMetadata('Goals', 'visitIsConverted', true); + $request->setMetadata('Goals', 'visitIsConverted', true); } } @@ -106,15 +106,15 @@ class GoalsRequestProcessor extends RequestProcessor // - the exception is caught here and will result in a new visit incorrectly // In this case, we cancel the current conversion to be recorded: $isManualGoalConversion = $this->isManualGoalConversion($request); - $requestIsEcommerce = $visitProperties->getRequestMetadata('Goals', 'isRequestEcommerce'); - $visitorNotFoundInDb = $visitProperties->getRequestMetadata('CoreHome', 'visitorNotFoundInDb'); + $requestIsEcommerce = $request->getMetadata('Goals', 'isRequestEcommerce'); + $visitorNotFoundInDb = $request->getMetadata('CoreHome', 'visitorNotFoundInDb'); if ($visitorNotFoundInDb && ($isManualGoalConversion || $requestIsEcommerce) ) { - $visitProperties->setRequestMetadata('Goals', 'goalsConverted', array()); - $visitProperties->setRequestMetadata('Goals', 'visitIsConverted', false); + $request->setMetadata('Goals', 'goalsConverted', array()); + $request->setMetadata('Goals', 'visitIsConverted', false); } } @@ -122,7 +122,7 @@ class GoalsRequestProcessor extends RequestProcessor public function recordLogs(VisitProperties $visitProperties, Request $request) { // record the goals if there were conversions in this request (even if the visit itself was not converted) - $goalsConverted = $visitProperties->getRequestMetadata('Goals', 'goalsConverted'); + $goalsConverted = $request->getMetadata('Goals', 'goalsConverted'); if (!empty($goalsConverted)) { $this->goalManager->recordGoals($visitProperties, $request); } |