Piwik seems to mix up visits from different visitors


I have a website where you can log in if you have an account. The data for each account are saved on another database : iduser, name, address…
And when there is a visitor who log in on the website, the iduser is saved in Piwik as a page custom variable .
So, in this way, I know how many visits have been done by each user in my database.

But, I get very weird data on Piwik: I get some visits with several idusers, sometimes until 50 differents idusers in one visit.
And it’s impossible. I check the value assigned to my custom variable and I’m sure that only the iduser can be assigned to it.

So, I did a test. With an account, I did a visit of one hour on my website, and I wrote down all the URL I visited and the hour.
Then, I checked on MySQL and there is no just one new visit with my iduser the previous hour, but 12 !
And I checked every visit one by one: I can see all the URL I visited with the matching time, but dispatched among the 12 visits !
Moreover, I can see others idusers saved with each visits, with anything to do with my iduser O_o

So, it seems that Piwik, in some way, mix the visits from different users as one visit.
But how is it possible ? Or what can I do to correct the data ?


How much traffic are you tracking per day?

That’s quite strange! Can you please try apply this fix: Different visitors with the same configuration visiting the site at same second, could be recorded as one visitor · Issue #4598 · matomo-org/matomo · GitHub

If that does not help (after a few days) please post here again and I’ll think of some other cause for this.

Thanks Matt, I’m testing with the new version of Piwik (2.03) and I’ll tell you the results.

No please try with 2.1 RC as 2.0.3 does not have the fix: 301 Moved Permanently

Thanks Matt, I will try.

But I’m wondering, if there have been some visitors mixed in one visit, that means that even the cookie in the browser of the visitor is including wrong data, isn’t it ?
So, maybe I should reset the piwik database (visit, log_link_visit_action and conversion tables) to get new fresh data and to generate new idvisitor.

Am I right ?


@matthieu or anyone… Can you please follow up on this issue? We are seeing the exact behavior as described by tia_le_coco couple of years ago in our installation of Piwik 3.0.4. It obviously mixes up data from different users into one visit. It there a way to understand how user ids are being generated out of the box?

Is it an intranet page? Then please have a look at How to - Analytics Platform - Piwik

Thanks @mediaproweb! Our Piwik is self-hosted behind a load balancer which does not yet forward IPs to Piwik. Thus we only see a couple of static IPs for internet site visits.

I will try the trust_visitors_cookies configuration.

Just for your info: It worked like a charm. :ok_hand:
Although it’s strange I need to tell Piwik to trust it’s own cookies :face_with_raised_eyebrow:

You’re just changing the recognition priority (Cookies>heuristics) with this setting. Heuristics cannot always differentiate between devices in an intranetlike environment, only cookies can. But they’re only used when the heuristics fail.

Please mark the thread /answer as solved.