Piwik_log_visit not inserting data for high idvisit value


We have piwik 2.10.0 installed and max value in this table for idvisit is 2160434211 .The issue is that every new visit is getting inserted but after first visit no action get captured into database but when we truncate piwik_log_visit then data getting captured normally .

Any idea please as we are losing high data volume and hits decreased from 5.5m to 2m .


1 Like


You can read about this issue herer:

Keep in mind that this has been fixed with Matomo 3. (At least I think so)

Thanks for the reply .

The actual issue was in following file function “updateExistingVisit” :


$idVisit = (int) $this->visitorInfo[‘idvisit’];

In above line, PHP integer parsing is applied and when idvisit value is greater than 2,147,483,647 (PHP 32bit is installed), it got set to 2,147,483,647 , so after first visit, previous visit id not found and hence query commits zero record .

One solution is to remove parse i.e remove (int) and other is to upgrade PHP to higher and 64bit version.

Are you also agree with solution ?


@Saqib_Ali Piwik 2.10 is really too old, and has serious security issues, please upgrade as soon as possible to Matomo 3.3.0

Yes the integer values will be capped at about 2 billion if your system is 32Bit as noted in PHP Doc:

The size of an integer is platform-dependent, although a maximum value of about two billion is the usual value (that’s 32 bits signed). 64-bit platforms usually have a maximum value of about 9E18, except on Windows prior to PHP 7, where it was always 32 bit. PHP does not support unsigned integers. Integer size can be determined using the constant PHP_INT_SIZE, maximum value using the constant PHP_INT_MAX since PHP 5.0.5, and minimum value using the constant PHP_INT_MIN since PHP 7.0.0.

I’ve issue a pull request to fix this particular issue: Fix a possible issue when there are more than 2 billion visits tracked and system is 32 bits by mattab · Pull Request #12469 · matomo-org/matomo · GitHub

Once you upgrade to Matomo 3.3 and apply this fix, does everything work fine for you?


thanks @matthieu .

Yes I have tested both , by removing parsing code i.e. (int) from the particulate line and by upgrading PHP to 64bit(>7.0) on IIS and upgrading PHP looks to me the right option as I do not have to find in code other places where parsing is applied.

Yes we have plans to upgrade to Matomo and above fix worked fine for Piwik 2.10 .