public function processVisit() { $request = \yii::$app->request; $params = []; $params['config_java'] = $request->get('java', 0); $params['config_pdf'] = $request->get('pdf', 0); $params['config_quicitime'] = $request->get('qt', 0); $params['config_realplayer'] = $request->get('realp', 0); $params['config_silverlight'] = $request->get('ag', 0); $params['config_windowsmedia'] = $request->get('wma', 0); $params['config_gears'] = $request->get('gears', 0); $params['config_flash'] = $request->get('fla', 0); $params['config_director'] = $request->get('dir', 0); $params['config_cookie'] = $request->get('cookie', 0); $params['lang'] = $request->get('lang', 0); $params['config_resolution'] = $this->getRes(); $params['location_browser_lang'] = $this->getSingleLanguageFromAcceptedLanguages($params['lang']); $params['location_ip'] = $this->getIp(); $params['idsite'] = $this->getIdSite(); $params['idvisitor'] = $this->getVisitorId(); $params['config_id'] = Settings::getConfigId($params['idsite'], $params['location_ip']); $userAgent = $this->getUserAgent(); $parser = DeviceDetectorFactory::getInstance($userAgent); $browserInfo = $parser->getClient(); $params['config_browser_engine'] = $browserInfo['engine']; $params['config_browser_version'] = $browserInfo['version']; $params['config_browser_name'] = $browserInfo['short_name']; $params['config_device_brand'] = $parser->getBrand(); $params['config_device_model'] = $parser->getModel(); $params['config_device_type'] = $parser->getDevice(); if ($parser->isBot()) { $os = Settings::OS_BOT; } else { $os = $parser->getOS(); $os = empty($os['short_name']) ? 'UNK' : $os['short_name']; } $params['config_os'] = $os; $params['config_os_version'] = $parser->getOs('version'); return $params; }
public static function getConfigId($idSite, $ipAddress) { list($plugin_Flash, $plugin_Java, $plugin_Director, $plugin_Quicktime, $plugin_RealPlayer, $plugin_PDF, $plugin_WindowsMedia, $plugin_Gears, $plugin_Silverlight, $plugin_Cookie) = Request::getPlugins(); $userAgent = Request::getUserAgent(); $deviceDetector = DeviceDetectorFactory::getInstance($userAgent); $aBrowserInfo = $deviceDetector->getClient(); if ($aBrowserInfo['type'] != 'browser') { // for now only track browsers unset($aBrowserInfo); } $browserName = !empty($aBrowserInfo['short_name']) ? $aBrowserInfo['short_name'] : 'UNK'; $browserVersion = !empty($aBrowserInfo['version']) ? $aBrowserInfo['version'] : ''; if ($deviceDetector->isBot()) { $os = self::OS_BOT; } else { $os = $deviceDetector->getOS(); $os = empty($os['short_name']) ? 'UNK' : $os['short_name']; } $browserLang = substr(\yii::$app->request->get('lang', ''), 0, 20); // limit the length of this string to match db return self::getConfigHash($idSite, $os, $browserName, $browserVersion, $plugin_Flash, $plugin_Java, $plugin_Director, $plugin_Quicktime, $plugin_RealPlayer, $plugin_PDF, $plugin_WindowsMedia, $plugin_Gears, $plugin_Silverlight, $plugin_Cookie, $ipAddress, $browserLang); }