diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/PiwikTracker/PiwikTracker.php | 71 |
1 files changed, 29 insertions, 42 deletions
diff --git a/libs/PiwikTracker/PiwikTracker.php b/libs/PiwikTracker/PiwikTracker.php index 93fad0bde4..9c2e1379a4 100644 --- a/libs/PiwikTracker/PiwikTracker.php +++ b/libs/PiwikTracker/PiwikTracker.php @@ -160,9 +160,22 @@ class PiwikTracker */ function __construct($idSite, $apiUrl = '') { + $this->userAgent = false; + $this->localHour = false; + $this->localMinute = false; + $this->localSecond = false; + $this->hasCookies = false; + $this->plugins = false; + $this->pageCustomVar = false; + $this->eventCustomVar = false; + $this->customData = false; + $this->forcedDatetime = false; + $this->forcedNewVisit = false; $this->token_auth = false; - - $this->init(); + $this->attributionInfo = false; + $this->ecommerceLastOrderTimestamp = false; + $this->ecommerceItems = array(); + $this->generationTime = false; $this->idSite = $idSite; $this->urlReferrer = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false; @@ -182,12 +195,23 @@ class PiwikTracker // Life of the session cookie (in sec) $this->configReferralCookieTimeout = 15768000; // 6 months + // Visitor Ids in order + $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->lastEcommerceOrderTs = false; // Allow debug while blocking the request $this->requestTimeout = 600; @@ -440,6 +464,9 @@ class PiwikTracker /** * Enables the bulk request feature. When used, each tracking action is stored until the * doBulkTrack method is called. This method will send all tracking data at once. + * + * Note: when you enable bulk tracking, all the properties of this object will be reset + * after each request is sent (ie. datetimes, settings, visitor id, etc. will be initialized to "false"). */ public function enableBulkTracking() { @@ -1158,11 +1185,6 @@ class PiwikTracker = $url . (!empty($this->userAgent) ? ('&ua=' . urlencode($this->userAgent)) : '') . (!empty($this->acceptLanguage) ? ('&lang=' . urlencode($this->acceptLanguage)) : ''); - - // if we run in bulk tracking mode, the next tracking request - // may be from a completely different visitor, so we clean up properties - $this->init(); - return true; } @@ -1508,41 +1530,6 @@ class PiwikTracker } return json_decode($cookie, $assoc = true); } - - /** - * Initializes properties - */ - protected function init() - { - $this->userAgent = false; - $this->localHour = false; - $this->localMinute = false; - $this->localSecond = false; - $this->hasCookies = false; - $this->plugins = false; - $this->pageCustomVar = false; - $this->eventCustomVar = false; - $this->customData = false; - $this->forcedDatetime = false; - $this->forcedNewVisit = false; - $this->attributionInfo = false; - $this->ecommerceLastOrderTimestamp = false; - $this->ecommerceItems = array(); - $this->generationTime = false; - - // Visitor Ids in order - $this->forcedVisitorId = false; - $this->cookieVisitorId = false; - $this->randomVisitorId = false; - - // Times - $this->currentTs = time(); - $this->createTs = $this->currentTs; - $this->visitCount = 0; - $this->currentVisitTs = false; - $this->lastVisitTs = false; - $this->lastEcommerceOrderTs = false; - } } /** |