Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorClayton Daley <clayton.daley@gmail.com>2013-10-15 04:26:29 +0400
committerClayton Daley <clayton.daley@gmail.com>2013-10-15 05:44:57 +0400
commite499c0945c141b91b2c29662a025baca7a86ade5 (patch)
treeaef675b12c193185f883f8142cb9e67777f6f007 /libs
parent458cec8ebd14d31d3a6feb64578b8a1e2b65a666 (diff)
Added several cookie variables to getRequest(). Added newVisitor to parallel piwik.js.
Diffstat (limited to 'libs')
-rw-r--r--libs/PiwikTracker/PiwikTracker.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/libs/PiwikTracker/PiwikTracker.php b/libs/PiwikTracker/PiwikTracker.php
index 4de6680e01..aa2c49fa92 100644
--- a/libs/PiwikTracker/PiwikTracker.php
+++ b/libs/PiwikTracker/PiwikTracker.php
@@ -91,12 +91,13 @@ class PiwikTracker
$this->updateClientCookies = false;
$this->clientCookiePath = '/';
$this->clientCookieDomain = '';
+ $this->newVisitor = 1;
$this->cookieVisitorId;
$this->currentTs = time();
$this->createTs = $this->currentTs;
$this->visitCount = 1;
- $this->currentVisitTs = $this->currentTs;
- $this->lastVisitTs = $this->currentTs;
+ $this->currentVisitTs = '';
+ $this->lastVisitTs = '';
$this->lastEcommerceOrderTs = '';
$this->idSite = $idSite;
$this->urlReferrer = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false;
@@ -842,6 +843,7 @@ class PiwikTracker
if ($idCookie !== false) {
$parts = explode('.',$idCookie);
if (strlen($parts[0]) == self::LENGTH_VISITOR_ID) {
+ $this->newVisitor = 0;
$this->cookieVisitorId = $parts[0]; // provides backward compatibility since getVisitorId() didn't change any existing VisitorId value
$this->createTs = $parts[1];
$this->visitCount = $parts[2];
@@ -1137,8 +1139,9 @@ class PiwikTracker
{
// Update client cookies in getRequest to parallel piwik.js logic
if ($this->updateClientCookies) {
- // Initialize cookie data if it's still defaulted to false
- if (!$this->lastVisitTs) {
+ // If we're setting cookies, we want to make sure we've loaded prevoius cookies
+ // Initialize cookie data if it's still defaulted to false
+ if (empty($this->lastVisitTs)) {
$this->loadVisitorIdCookie();
}
$sesname = $this->getCookieName('ses');
@@ -1157,8 +1160,12 @@ class PiwikTracker
'&apiv=' . self::VERSION .
'&r=' . substr(strval(mt_rand()), 2, 6) .
- (!empty($this->ip) ? '&_viewts=' . $this-> : '') .
-
+ // Values collected from cookie
+ '&_idts=' . $this->createTs .
+ '&_idvc=' . $this->visitCount .
+ (!empty($this->lastVisitTs) ? '&_viewts=' . $this->lastVisitTs : '' ) . // note that piwik.js sends an empty value instead of skipping
+ (!empty($this->lastEcommerceOrderTs) ? '&_ects=' . $this->lastEcommerceOrderTs : '' ) .
+
// XDEBUG_SESSIONS_START and KEY are related to the PHP Debugger, this can be ignored in other languages
(!empty($_GET['XDEBUG_SESSION_START']) ? '&XDEBUG_SESSION_START=' . @urlencode($_GET['XDEBUG_SESSION_START']) : '') .
(!empty($_GET['KEY']) ? '&KEY=' . @urlencode($_GET['KEY']) : '') .