public function __construct($idSite, $apiUrl = '') { $this->ecommerceItems = array(); $this->attributionInfo = false; $this->eventCustomVar = false; $this->forcedDatetime = false; $this->forcedNewVisit = false; $this->generationTime = false; $this->pageCustomVar = false; $this->customParameters = array(); $this->customData = false; $this->hasCookies = false; $this->token_auth = false; $this->userAgent = false; $this->country = false; $this->region = false; $this->city = false; $this->lat = false; $this->long = false; $this->width = false; $this->height = false; $this->plugins = false; $this->localHour = false; $this->localMinute = false; $this->localSecond = false; $this->idSite = $idSite; $this->urlReferrer = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false; $this->pageCharset = self::DEFAULT_CHARSET_PARAMETER_VALUES; $this->pageUrl = self::getCurrentUrl(); $this->ip = !empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : false; $this->acceptLanguage = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : false; $this->userAgent = !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : false; if (!empty($apiUrl)) { self::$URL = $apiUrl; } // Life of the visitor cookie (in sec) $this->configVisitorCookieTimeout = 33955200; // 13 months (365 + 28 days) // Life of the session cookie (in sec) $this->configSessionCookieTimeout = 1800; // 30 minutes // Life of the session cookie (in sec) $this->configReferralCookieTimeout = 15768000; // 6 months // Visitor Ids in order $this->userId = false; $this->forcedVisitorId = false; $this->cookieVisitorId = false; $this->randomVisitorId = false; $this->setNewVisitorId(); $this->configCookiesDisabled = false; $this->configCookiePath = self::DEFAULT_COOKIE_PATH; $this->configCookieDomain = ''; $this->currentTs = time(); $this->createTs = $this->currentTs; $this->visitCount = 0; $this->currentVisitTs = false; $this->lastVisitTs = false; $this->ecommerceLastOrderTimestamp = false; // Allow debug while blocking the request $this->requestTimeout = 600; $this->doBulkRequests = false; $this->storedTrackingActions = array(); $this->sendImageResponse = true; $this->visitorCustomVar = $this->getCustomVariablesFromCookie(); }