Piwik\Tracker\GoalManager::recordStandardGoals PHP Méthode

recordStandardGoals() protected méthode

Records a standard non-Ecommerce goal in the DB (URL/Title matching), linking the conversion to the action that triggered it
protected recordStandardGoals ( Piwik\Tracker\Visit\VisitProperties $visitProperties, Request $request, $goal, Action $action )
$visitProperties Piwik\Tracker\Visit\VisitProperties
$request Request
$goal
$action Action
    protected function recordStandardGoals(VisitProperties $visitProperties, Request $request, $goal, $action)
    {
        $visitor = Visitor::makeFromVisitProperties($visitProperties, $request);
        $convertedGoals = $request->getMetadata('Goals', 'goalsConverted') ?: array();
        foreach ($convertedGoals as $convertedGoal) {
            $this->currentGoal = $convertedGoal;
            Common::printDebug("- Goal " . $convertedGoal['idgoal'] . " matched. Recording...");
            $conversion = $goal;
            $conversion['idgoal'] = $convertedGoal['idgoal'];
            $conversion['url'] = $convertedGoal['url'];
            if (!is_null($action)) {
                $conversion['idaction_url'] = $action->getIdActionUrl();
                $conversion['idlink_va'] = $action->getIdLinkVisitAction();
            }
            // If multiple Goal conversions per visit, set a cache buster
            $conversion['buster'] = $convertedGoal['allow_multiple'] == 0 ? '0' : $visitProperties->getProperty('visit_last_action_time');
            $conversionDimensions = ConversionDimension::getAllDimensions();
            $conversion = $this->triggerHookOnDimensions($request, $conversionDimensions, 'onGoalConversion', $visitor, $action, $conversion);
            $this->insertNewConversion($conversion, $visitProperties->getProperties(), $request);
        }
    }