Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2013-04-20 13:02:35 +0400
committermattab <matthieu.aubry@gmail.com>2013-04-20 13:02:36 +0400
commit35f975accb45152dd669e0009237eed3dc6ada2b (patch)
tree8a0a82519a8a3502ae18c31ae3db7bf2d148af55 /plugins/UserCountry
parent6575c1f85e6d4276cbce2d8a22535c6d499cb8ce (diff)
Fixes #3904:
* new segment 'siteSearchKeyword' Fixes #3903, #3905: * adding few fields in the Live API output to accomodate getSuggestedValuesForSegment * renamed other fields for consistency with segment names Fixes #3906: * new API: getSuggestedValuesForSegment which returns top suggested values for a particular segment. It uses the Live.getLastVisitsDetails API to fetch the most recently used values, and will show the most used values first * Adding tests for everything. The test case actually generates data for all segments so that VisitsSummary.get returns some data for each of the 47 segments being tested returns some data. How it works: * generate extended data in fixture * Tests (1) call getSuggestedValuesForSegment for each segment, check there is some data returned for each segment * get the first suggested value from the list, * Tests (2) call VisitsSummary.get with this segment value, eg. countryCode==ru. * I worked this way for all 47 segments until all tests had some data ==> now we know that all segments have been tested and that the auto suggest works for all segments. TDD FTW!
Diffstat (limited to 'plugins/UserCountry')
-rw-r--r--plugins/UserCountry/UserCountry.php13
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/UserCountry/UserCountry.php b/plugins/UserCountry/UserCountry.php
index 20d2935248..34003af178 100644
--- a/plugins/UserCountry/UserCountry.php
+++ b/plugins/UserCountry/UserCountry.php
@@ -164,7 +164,7 @@ class Piwik_UserCountry extends Piwik_Plugin
'type' => 'dimension',
'category' => 'Visit Location',
'name' => Piwik_Translate('UserCountry_Country'),
- 'segment' => 'country',
+ 'segment' => 'countryCode',
'sqlSegment' => 'log_visit.location_country',
'acceptedValues' => 'de, us, fr, in, es, etc.',
);
@@ -172,7 +172,7 @@ class Piwik_UserCountry extends Piwik_Plugin
'type' => 'dimension',
'category' => 'Visit Location',
'name' => Piwik_Translate('UserCountry_Continent'),
- 'segment' => 'continent',
+ 'segment' => 'continentCode',
'sqlSegment' => 'log_visit.location_country',
'acceptedValues' => 'eur, asi, amc, amn, ams, afr, ant, oce',
'sqlFilter' => array('Piwik_UserCountry', 'getCountriesForContinent'),
@@ -181,7 +181,7 @@ class Piwik_UserCountry extends Piwik_Plugin
'type' => 'dimension',
'category' => 'Visit Location',
'name' => Piwik_Translate('UserCountry_Region'),
- 'segment' => 'region',
+ 'segment' => 'regionCode',
'sqlSegment' => 'log_visit.location_region',
'acceptedValues' => '01 02, OR, P8, etc.<br/>eg. region=A1;country=fr',
);
@@ -197,7 +197,7 @@ class Piwik_UserCountry extends Piwik_Plugin
'type' => 'dimension',
'category' => 'Visit Location',
'name' => Piwik_Translate('UserCountry_Latitude'),
- 'segment' => 'lat',
+ 'segment' => 'latitude',
'sqlSegment' => 'log_visit.location_latitude',
'acceptedValues' => '-33.578, 40.830, etc.<br/>You can select visitors within a lat/long range using &segment=lat&gt;X;lat&lt;Y;long&gt;M;long&lt;N.',
);
@@ -205,7 +205,7 @@ class Piwik_UserCountry extends Piwik_Plugin
'type' => 'dimension',
'category' => 'Visit Location',
'name' => Piwik_Translate('UserCountry_Longitude'),
- 'segment' => 'long',
+ 'segment' => 'longitude',
'sqlSegment' => 'log_visit.location_longitude',
'acceptedValues' => '-70.664, 14.326, etc.',
);
@@ -489,9 +489,8 @@ class Piwik_UserCountry extends Piwik_Plugin
*/
public static function getCountriesForContinent($continent)
{
- $continent = strtolower($continent);
-
$result = array();
+ $continent = strtolower($continent);
foreach (Piwik_Common::getCountriesList() as $countryCode => $continentCode) {
if ($continent == $continentCode) {
$result[] = $countryCode;