Different users in one visit?

I wrote a script that reads records from another tracking database (not Piwik), and converts/reports them to Piwik. According to piwik.php debug info, all tracking fields are converted properly, and I get the right number of rows in piwik_log_link_visit_action. Manual inspection of the data also confirms this. However, piwik_log_visit seems to have some anomalous data.

For instance, the following query should not return anything:
SELECT 1 FROM piwik_log_visit AS v LEFT JOIN piwik_log_link_visit_action AS l ON v.idvisit = l.idvisit WHERE DATE(l.server_time) = ‘2012-02-19’ AND v.idvisitor <> l.idvisitor

But there are many rows in piwik_log_visit where different visitors are associated with the same visit. Please let me know if I have the wrong idea about how piwik_log_visit works. Also, could it be because of concurrency issues when writing to the database?

When I was reporting actions to Piwik, VisitSummary and VisitFrequency plugins were activated. Feel free to ask for more details.

Thanks,
Pooya

Thanks for the report. I’m seeing this in ~ 1.6% of cases. I committed a patch in: In some rare cases, page views have a different idvisitor but belong to the same visit · Issue #3022 · matomo-org/matomo · GitHub
please test it, and if you have any problem, comment on the ticket. Thanks!

Thanks Matt. It solved the problem. I also set trust_visitors_cookies to 1, so it doesn’t combine multiple visitors into one just because they have the same IP.