sum_daily_nb_uniq_visitors calculations incorrect for some ranges with UserCountry API

Has anyone else had issues with ‘sum_daily_nb_uniq_visitors’ returned from the API? I am getting very odd results that I cannot explain.

I am using the UserCountry.getCity method. When I make a call for a range of 2013-10-01 to 2013-10-31, ‘sum_daily_nb_uniq_visitors’ values appear correct, based on historical usage of the site, typically around 95% of nb_visits.

If, however, I increase the date range by moving the start date back one day to make the range 2013-09-30 to 2013-10-31, ‘sum_daily_nb_uniq_visitors’ values actually decrease by a ridiculously large amount. Something has to be wrong here.

I’ve noted this same behavior in getRegion and getCountry methods as well.

Anyone else notice this problem and/or have a workaround for it?

UPDATE: I realized I didn’t make it very clear, but this is happening when period=range.

Can you try with 2.0-beta ? we fixed several things so it may work better.

If you still have the problem with 2,0-beta could you post URLs showing the bug, from the demo.piwik.org ?

I am unable, at this moment, to set up 2.0beta and perform these tests. I can report back with my findings when I am able to do so. In the meantime, I ran the tests from piwik.org

Here is an example using the Piwik.org API reference URLs and data ->

http://demo.piwik.org/?module=API&method=UserCountry.getCity&idSite=3&period=range&date=2013-10-01,2013-10-31&format=xml&token_auth=anonymous

For October 1st to the 31st, for ‘Unknown city’, the API reports 252 visits and 248 sum daily unique visitors. That’s look correct.

Now set the start date for that range back one day into the previous month…

http://demo.piwik.org/?module=API&method=UserCountry.getCity&idSite=3&period=range&date=2013-09-30,2013-10-31&format=xml&token_auth=anonymous

For September 30th to October 31st (one day more than the previous range), for ‘Unknown city’, the API reports 260 visits, but only 31 sum daily unique visitors.

This error exists for all cities in the results, and the same in the regions and countries reports as well.

I’ve installed Piwik 2.0-b11 and have performed the same test. These problems still exist, in fact I am noticing additional strange behavior.

Referencing the results for Germany in the following reports:

2013-11-01 to 2013-11-30:
http://demo.piwik.org/?module=API&method=UserCountry.getCountry&idSite=7&period=range&date=2013-11-01,2013-11-30&format=xml&token_auth=anonymous

nb_visits = 5380, sum_daily_nb_uniq_visitors = 4759

Add one day 2013-11-01 to 2013-12-01:
http://demo.piwik.org/?module=API&method=UserCountry.getCountry&idSite=7&period=range&date=2013-11-01,2013-12-01&format=xml&token_auth=anonymous

Empty result set.

Add another day 2013-11-01 to 2013-12-02:
http://demo.piwik.org/?module=API&method=UserCountry.getCountry&idSite=7&period=range&date=2013-11-01,2013-12-02&format=xml&token_auth=anonymous

nb_visits = 5696, sum_daily_nb_uniq_visitors = 289 (!?)

This appears to be a problem more global in nature, as it is not limitted to only the UserCountry methods. I found the same problem exists in DevicesDetection, UserSettings, and Provider methods as well.

The sum_nb_uniq_daily_visitors is unreliable, but it appears that you really found a bug as well!

Can you reproduce this on the demo.piwik.org ?

if you can, please post a ticket bug at: dev.piwik.org with API links showing the error. we will definitely fix it!

The bug is reproducible in within demo.piwik.org… the sample URLs I provided are using that instance of Piwik.

I’ve submitted a new bug in the developer zone.

http://dev.piwik.org/trac/ticket/4377#ticket

The bug is reproducible in within demo.piwik.org… the sample URLs I provided are using that instance of Piwik.

I’ve submitted a new bug in the developer zone.

http://dev.piwik.org/trac/ticket/4377#ticket

The bug is reproducible in within demo.piwik.org… the sample URLs I provided are using that instance of Piwik.

I’ve submitted a new bug in the developer zone.

http://dev.piwik.org/trac/ticket/4377#ticket