Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API.getMetaData includes unique visitors in year period #1598

Closed
gka opened this issue Aug 16, 2010 · 7 comments
Closed

API.getMetaData includes unique visitors in year period #1598

gka opened this issue Aug 16, 2010 · 7 comments
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@gka
Copy link
Contributor

gka commented Aug 16, 2010

The API call

?module=API&method=API.getMetadata&format=XML&apiModule=UserCountry&apiAction=getCountry&period=year

includes the metric "unique visitors" which is not included in the corresponding getProcessedReport call

?module=API&method=API.getProcessedReport&format=XML&apiModule=UserCountry&apiAction=getCountry&period=year
Keywords: metadata,api

@gka
Copy link
Contributor Author

gka commented Aug 24, 2010

I'm not quite sure about the expected behaviour. Maybe the bug is not that API.getMetaData includes the unique visitor metric, but that API.getProcessedReport does not include it. However, I think both functions should return the same metrics.

The bug appears only in time periods other than day. I found this bug because the new map plugin calls API.getMetaData to build the HTML Select and the flash map calls API.getProcessedReport to load the data. If you change the time to anything but day, you'll find the metric "unique visitors" in the Select but the map does not display it, because it is missing in the getProcessedReport result.

Hope the bug is clearer now. I'll try to locate the bug in the API plugin.

@gka
Copy link
Contributor Author

gka commented Aug 24, 2010

I found the code which removes the unique visitors from the processed metrics in line 308 and 309 in plugins/API/API.php.

if($period != 'day')
{
    unset($columns['nb_uniq_visitors']);
    unset($reportMetadata['metrics']['nb_uniq_visitors']);
}

It looks like the API.getMetaData results are independent of the selected time period and thus always include the unique visitor metrics. Since I don't want to touch the code I'll rather add a workaround to the map plugin which removes the unique visitors manually.

@gka
Copy link
Contributor Author

gka commented Aug 24, 2010

You may change the ticket priority to minor and move it to a later milestone.

@robocoder
Copy link
Contributor

matt: why is it unsetting for period != 'day'? Shouldn't this be period != 'year' given #842 r1301?

@mattab
Copy link
Member

mattab commented Aug 26, 2010

oops, my mistake, it should be period == year. Thanks for investigating greg & vipsoft

@mattab
Copy link
Member

mattab commented Nov 24, 2010

(In [3329]) Fixes #1598
Unique Visitors now out of the API resultset, the UI, and the Api metadata response, when period=year. Adding API metadata test for period=year.

@mattab
Copy link
Member

mattab commented Nov 24, 2010

(In [3330]) Refs #1598
Fixing notice in sparkline widgets

@gka gka added this to the Piwik 1.1 milestone Jul 8, 2014
@gka gka added T: Bug labels Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

3 participants