Skip to content

Commit 3a002c5

Browse files
authored
Merge pull request matomo-org#44 from MichaelHeerklotz/unlink_userid_and_visitorid
Unlink userId and visitorId logic
2 parents 2d23bea + ee74196 commit 3a002c5

1 file changed

Lines changed: 0 additions & 11 deletions

File tree

PiwikTracker.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ public function clearCustomTrackingParameters()
363363
public function setNewVisitorId()
364364
{
365365
$this->randomVisitorId = substr(md5(uniqid(rand(), true)), 0, self::LENGTH_VISITOR_ID);
366-
$this->userId = false;
367366
$this->forcedVisitorId = false;
368367
$this->cookieVisitorId = false;
369368
return $this;
@@ -1171,10 +1170,6 @@ public function setIp($ip)
11711170
*/
11721171
public function setUserId($userId)
11731172
{
1174-
if ($userId === false) {
1175-
$this->setNewVisitorId();
1176-
return $this;
1177-
}
11781173
if ($userId === '') {
11791174
throw new Exception("User ID cannot be empty.");
11801175
}
@@ -1197,15 +1192,12 @@ public static function getUserIdHashed($id)
11971192

11981193
/**
11991194
* Forces the requests to be recorded for the specified Visitor ID.
1200-
* Note: it is recommended to use ->setUserId($userId); instead.
12011195
*
12021196
* Rather than letting Piwik attribute the user with a heuristic based on IP and other user fingeprinting attributes,
12031197
* force the action to be recorded for a particular visitor.
12041198
*
1205-
* If you use both setVisitorId and setUserId, setUserId will take precedence.
12061199
* If not set, the visitor ID will be fetched from the 1st party cookie, or will be set to a random UUID.
12071200
*
1208-
* @deprecated We recommend to use ->setUserId($userId).
12091201
* @param string $visitorId 16 hexadecimal characters visitor ID, eg. "33c31e01394bdc63"
12101202
* @return $this
12111203
* @throws Exception
@@ -1242,9 +1234,6 @@ public function setVisitorId($visitorId)
12421234
*/
12431235
public function getVisitorId()
12441236
{
1245-
if (!empty($this->userId)) {
1246-
return $this->getUserIdHashed($this->userId);
1247-
}
12481237
if (!empty($this->forcedVisitorId)) {
12491238
return $this->forcedVisitorId;
12501239
}

0 commit comments

Comments
 (0)