Hi Matt
Yes, I had set the token auth. As you can see in image 2, the past time had been recorded correctly (which is 8 August), but it grouped with the record on 9 August which is not correct.
After reading the debug message, I realised that the problem is in the sql query of ‘core/Tracker/Visit.php’.
// In line 1014. Piwik 1.8.2
//This sql query search for the visit_last_action_time >= ( $forcedDateTime - 30 mins) and returns the latest record of a unique visitor with the same ip address. This will do the grouping correctly if you are tracking the current timestamp, but if you are tracking a past timestamp and the visitor has no record on the same past timestamp in the database, then it will be grouped to a different date.
$whereSameBothQueries = “visit_last_action_time >= ? AND idsite = ?”;
// will use INDEX index_idsite_config_datetime (idsite, config_id, visit_last_action_time)
$bindSql[] = $timeLookBack;
$bindSql[] = $this->idsite;
$where = ’ AND config_id = ?’;
$bindSql[] = $configId;
$sqlConfigId = “$select ,
0 as priority
$from
WHERE $whereSameBothQueries $where
ORDER BY visit_last_action_time DESC
LIMIT 1
”;
// will use INDEX index_idsite_idvisitor (idsite, idvisitor)
$bindSql[] = $timeLookBack;
$bindSql[] = $this->idsite;
$where = ’ AND idvisitor = ?’;
$bindSql[] = $this->visitorInfo[‘idvisitor’];
$sqlVisitorId = “$select ,
1 as priority
$from
WHERE $whereSameBothQueries $where
LIMIT 1
”;
// We join both queries and favor the one matching the visitor_id if it did match
$sql = " ( $sqlConfigId )
UNION
( $sqlVisitorId )
ORDER BY priority DESC
LIMIT 1";
For example (please refer to the images):
step 1
I add a tracking with the following details
ip: 192.168.0.1
forceVisitorId(cid): 1000000000000001
action: Test3
domain: https://test.domain.com
datetime: current timestamp (let say 09/08/2012 11:50:02)
step 2
I added a past tracking with past timestamp
ip: 192.168.0.1
forceVisitorId(cid): 1000000000000002
action: Test4
domain: https://test.domain.com
datetime: 08/08/2012 11:50:02
step 3
This 2 visits will then group together as shown in image 2
Sorry for my bad explaination, if you find hard to understand.
Regards
Hao