getIpString() public method

public getIpString ( ) : mixed | string
return mixed | string
Example #1
0
 public function processRequestParams(VisitProperties $visitProperties, Request $request)
 {
     // the IP is needed by isExcluded() and GoalManager->recordGoals()
     $visitProperties->setProperty('location_ip', $request->getIp());
     $excluded = new VisitExcluded($request);
     if ($excluded->isExcluded()) {
         return true;
     }
     $privacyConfig = new PrivacyManagerConfig();
     $ip = $request->getIpString();
     if ($privacyConfig->useAnonymizedIpForVisitEnrichment) {
         $ip = $visitProperties->getProperty('location_ip');
     }
     // visitor recognition
     $visitorId = $this->userSettings->getConfigId($request, $ip);
     $request->setMetadata('CoreHome', 'visitorId', $visitorId);
     $isKnown = $this->visitorRecognizer->findKnownVisitor($visitorId, $visitProperties, $request);
     $request->setMetadata('CoreHome', 'isVisitorKnown', $isKnown);
     $isNewVisit = $this->isVisitNew($visitProperties, $request);
     $request->setMetadata('CoreHome', 'isNewVisit', $isNewVisit);
     return false;
 }
 private function getVisitorIdFromRequest(Tracker\Request $request)
 {
     try {
         $visitorId = $request->getVisitorId();
     } catch (InvalidRequestParameterException $e) {
         $visitorId = null;
     }
     if (empty($visitorId)) {
         // we create a md5 otherwise IP's starting with 1 or 2 would be likely moved into same queue
         $visitorId = md5($request->getIpString());
     } else {
         $visitorId = bin2hex($visitorId);
     }
     return $visitorId;
 }