/** * @param Request $request * @param Visitor $visitor * @param Action|null $action * @param GoalManager $goalManager * * @return mixed|false */ public function onGoalConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager) { $defaultRevenue = $goalManager->getGoalColumn('revenue'); $revenue = $request->getGoalRevenue($defaultRevenue); return $this->roundRevenueIfNeeded($revenue); }
/** * This event is triggered when an any custom goal is converted. In this example we would store a the id of the * goal in the 'example_conversion_dimension' column if the visitor is known and nothing otherwise. * Return boolean false if you do not want to change the value in some cases. If you do not want to perform any * action on an ecommerce order at all it is recommended to just remove this method. * * @param Request $request * @param Visitor $visitor * @param Action|null $action * @param GoalManager $goalManager * * @return mixed|false */ public function onGoalConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager) { $goalId = $goalManager->getGoalColumn('idgoal'); if ($visitor->isVisitorKnown()) { return $goalId; } return false; }