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

Include segment codes, where applicable, in all API results #4381

Closed
jasonbukowski opened this issue Dec 13, 2013 · 2 comments
Closed

Include segment codes, where applicable, in all API results #4381

jasonbukowski opened this issue Dec 13, 2013 · 2 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

Comments

@jasonbukowski
Copy link

Currently in calls to UserCountry methods, the results include codes that can be used if you wanted to call another report using a segment of a country/region/city.

For example ->
Calls to UserCountry.getCountry include <code>us</code> for the United States data row.
Calls to UserCountry.getRegion include <region>FL</region> <country>us</country> for the Florida data row.

This is extremely useful if one wants to display a list of countries, and allow the user to select a country and get further data based on that segment. This is possible because the original results contains the codes needed to make subsequent segmented calls.

I propose that inclusion of these codes be a standard practice for all relevant API results.

While I've not reviewed data results from all API methods, a few that I can point out being in need of such a feature addition include ->

DevicesDetection.getOsVersions -> include operatingSystemCode
DevicesDetection.getBrowserFamilies -> include browserCode
DevicesDetection.getBrowserVersions -> include browserCode, browserVersion
UserSettings.getOS -> include operatingSystemCode
UserSettings.getBrowserVersion -> include browserCode, browserVersion
UserSettings.getBrowser -> include browserCode

Basically, it would be great if anywhere results are given where the label cannot be used as a segment value and a code must be used instead, that code would be included in the results.

@mattab
Copy link
Member

mattab commented Dec 16, 2013

Thanks for the suggestion, it makes a lot of sense.

@jasonbukowski jasonbukowski added this to the 2.x - The Great Piwik 2.x Backlog milestone Jul 8, 2014
@mattab mattab modified the milestones: Long term, Mid term Dec 5, 2016
@sgiehl
Copy link
Member

sgiehl commented Nov 18, 2017

that should be solved with the <segment> included in API results, like in https://github.com/piwik/piwik/blob/3.x-dev/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__Referrers.getKeywords_day.xml#L20

@sgiehl sgiehl closed this as completed Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

3 participants