Negative Visit Length?

I’m using an automated system to transform stats of a website (collected by another analytics framework) to Piwik HTTP calls. Since the visits have happened in the past, I need to use token_auth to set the time to past.

The problem is, the visits are not sorted by time. Sometimes, different visits by same users are reported out of order, and it causes Piwik_log_visit to have anomalous rows; rows where visit_first_action_time is later than visit_last_action_time, which means the length of that visit is negative.

Is there any way I can fix that?

Thanks,
Pooya

You need to send page views in the same “visit” in order… this is by design.

Fair enough; I suppose it’s computationally hard to find the right “visit” back in the historical data to add the action to, but if the tracker does a sanity check before changing the visit_last_action_time and possibly make a new visit, the result would be much more accurate. I’ll try doing it in my local version, but please consider adding the check in the next release to have a Piwik of higher quality.

Cheers,
Pooya