API calls to suggested values for segments that are static lists (eg. countries) will now be returned sorted by the most used values first. This should mitigate the issue where suggested value lists do not contain the most frequently used values.
For example, the getSuggestedValuesForSegment list for countryName will now return a list of country names with the countries that have the most visits at the top rather than an alphabetical list potentially containing countries that have no visits or missing countries with many visits but names towards the end of the alphabet.
This has been applied to segments: countryName, browserName and operatingSystemName
Looks good and works as expected.
As you mentioned it might be better not to have a static list of segments that don't need the most frequent values. A possibility might be to change the
Segment class. So it has a new property that defines if it requires most frequent values or not. And the method
setSuggestedValuesCallback could have a second (optional) parameter that sets the property.
I've added a property to the
Segment class to indicate if it requires the frequent values method to be run. The static list of segments has been removed.