Hi,
I am going to upgrade to Piwik 1.3, I have read the code of core/Tracker/Visit.php and found in the code a bug(might not be a bug, need your confirmation), which starts from #344:
$idVisitor = Piwik_Common::getRequestVar('_id', '', 'string', $this->request);
if(strlen($idVisitor) == Piwik_Tracker::LENGTH_HEX_ID_STRING)
{
$valuesToUpdate['idvisitor'] = Piwik_Common::hex2bin($idVisitor);
}
In the preceding code, Piwik does not test whether 3rd party cookie is enabled and use 1st party cookie directly. As on #839 in core/Tracker/Visit.php, 3rd cookie takes higher priority when enabled.
It looks to me the preceding code should be modified to take 3rd party cookie into account, something like the following:
$idVisitor = '';
$useThirdPartyCookie = $this->shouldUseThirdPartyCookie();
if($useThirdPartyCookie)
{
$idVisitor = $this->cookie->get(0);
if($idVisitor == false || strlen($idVisitor) != Piwik_Tracker::LENGTH_HEX_ID_STRING)
{
$idVisitor = Piwik_Common::getRequestVar('_id', '', 'string', $this->request);
}
}
if(strlen($idVisitor) == Piwik_Tracker::LENGTH_HEX_ID_STRING)
{
$valuesToUpdate['idvisitor'] = Piwik_Common::hex2bin($idVisitor);
}
Please confirm me if I am wrong or right, thank you!
Regards,
Kevin