I am using 2.0-b12, but believe this error has been around in previous versions (back to 1.12) as well.
The nb_visits count returned by the API for UserCountry, Provider, DeviceDetection, and UserSettings is returning incorrect values in certain circumstances.
I am using the API with period=range.
With date values such as 2013-11-01,2013-11-30, the value returned is correct. If I reduce that date range by one day, the value drops by nearly 75%.
Here are a few sample results (Using UserCountry.getCountry and referencing the value for the US) ->
2013-11-01,2013-11-01 - nb_visits = 345
2013-11-01,2013-11-08 - nb_visits = 3233
2013-11-01,2013-11-15 - nb_visits = 2841
2013-11-01,2013-11-22 - nb_visits = 2875
2013-11-01,2013-11-29 - nb_visits = 2368
2013-11-01,2013-11-30 - nb_visits = 10211
As you can see, these results are all over the place. I suspect that only the 1st and 30th are correct, perhaps the 8th as well. Unfortunately, I am unable to reproduce these results with the Piwik demo instance, which lead me to believe that maybe the problem is unique to my data. I tried deleting my archives and reprocessing all the reports, but that made no impact.
Has anyone else ever encountered this problem or have any suggested remedy to correct this?