setSegment('myConversionSegmentName'); $segment->setCategory('General_Visit'); $segment->setName('ExampleTracker_DimensionName'); $segment->setAcceptedValues('Here you should explain which values are accepted/useful: Any number, for instance 1, 2, 3 , 99'); $this->addSegment($segment); } /** * This event is triggered when an ecommerce order is converted. In this example we would store a "0" in case it * was the visitors first action or "1" 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 onEcommerceOrderConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager) { if ($visitor->isVisitorKnown()) { return 1; } return 0; } /** * This event is triggered when an ecommerce cart update is converted. In this example we would store a * the value of the tracking url parameter "myCustomParam" in the "example_conversion_dimension" column. * 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 onEcommerceCartUpdateConversion(Request $request, Visitor $visitor, $action, GoalManager $goalManager) { return Common::getRequestVar('myCustomParam', $default = false, 'int', $request->getParams()); } /** * 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; } }