protected function getUrlOverrideValueIfAllowed($urlParamToOverride, Request $request) { if (!$request->isAuthenticated()) { return false; } $value = Common::getRequestVar($urlParamToOverride, false, 'string', $request->getParams()); if (!empty($value)) { return $value; } return false; }
/** * This event is triggered before a new action is logged to the log_link_visit_action table. It overwrites any * looked up action so it makes usually no sense to implement both methods but it sometimes does. You can assign * any value to the column or return boolan false in case you do not want to save any value. * * @param Request $request * @param Visitor $visitor * @param Action $action * * @return mixed|false */ public function onNewAction(Request $request, Visitor $visitor, Action $action) { if (!$action instanceof ActionPageview) { // save value only in case it is a page view. return false; } $value = Common::getRequestVar('my_page_keywords', false, 'string', $request->getParams()); if (false === $value) { return $value; } $value = trim($value); return substr($value, 0, 255); }
/** * @param Request $request * @param Visitor $visitor * @param Action|null $action * @return mixed */ public function onNewVisit(Request $request, Visitor $visitor, $action) { return Common::getRequestVar('fla', 0, 'int', $request->getParams()); }
/** * 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()); }