piwik/piwik — pull request #6298 by tsteur (2014-09-25 11:12:30+00:00)
Title: Fix detection of a known visitor when there are multiple requests at same second for same visitor

#6296 This is a bug in Piwik that must be there already for quite a while. What is happening is that Piwik creates a new visitor in case there are multiple requests at the same second. This happens especially when using bulk tracking.

Problem is this line: https://github.com/piwik/piwik/blob/2.7.0/core/Tracker/Visit.php#L476

It checks whether a row was changed and if not, it thinks it did not find the visitor. But what is actually happening is that an existing visitor is found but there was simply no change in any of those values (idvisitor, visit_total_time, visit_last_action_time). So MySQL will return `0` as well.

To always have at least one column that changes there the idea was to introduce a new column that will always change (or in 99.9999% of the cases) by generating a random string each time. This way we can differentiate between visitor actually not found or no change.