/**
  * Make a remote call to freegeoip.net to detect country of current customer session and store it into session
  *
  * @return $this
  */
 public function saveVisitorData($observer)
 {
     $clientIP = $this->_request->getClientIp();
     $httpClient = new Client();
     $clientIP = $this->getRandomeIp($clientIP);
     $uri = self::URL_GEO_IP_SITE . $clientIP;
     $httpClient->setUri($uri);
     $httpClient->setOptions(array('timeout' => 30));
     try {
         $response = JsonDecoder::decode($httpClient->send()->getBody());
         $this->_customerSession->setVisitorData($response);
         //save to database
         $currenttime = date('Y-m-d H:i:s');
         $model = $this->_objectManager->create('Bluecom\\Freegeoip\\Model\\Visitor');
         $model->setData('visitor_ip', $response->ip);
         $model->setData('country_code', $response->country_code);
         $model->setData('country_name', $response->country_name);
         $model->setData('region_code', $response->region_code);
         $model->setData('region_name', $response->region_name);
         $model->setData('city', $response->city);
         $model->setData('zip_code', $response->zip_code);
         $model->setData('latitude', $response->latitude);
         $model->setData('longitude', $response->longitude);
         $model->setData('metro_code', $response->metro_code);
         $model->setData('browser', $_SERVER['HTTP_USER_AGENT']);
         $model->setData('os', php_uname());
         $model->setData('created', $currenttime);
         $model->save();
     } catch (\Exception $e) {
         $this->_logger->critical($e);
     }
     return $this;
 }