Skip to content

Commit

Permalink
Refs #5291 Revert commit because it broke too many tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattab committed Jun 5, 2014
1 parent dbd8960 commit 774431d
Showing 1 changed file with 29 additions and 42 deletions.
71 changes: 29 additions & 42 deletions libs/PiwikTracker/PiwikTracker.php
Expand Up @@ -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;
Expand All @@ -182,12 +195,23 @@ function __construct($idSite, $apiUrl = '')
// 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;
Expand Down Expand Up @@ -440,6 +464,9 @@ public function setLongitude($long)
/**
* 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()
{
Expand Down Expand Up @@ -1158,11 +1185,6 @@ protected function sendRequest($url, $method = 'GET', $data = null, $force = fal
= $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;
}

Expand Down Expand Up @@ -1508,41 +1530,6 @@ protected function getCustomVariablesFromCookie()
}
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;
}
}

/**
Expand Down

0 comments on commit 774431d

Please sign in to comment.