diff --git a/core/IP.php b/core/IP.php index b7bdf54e711fedc75050b4070732676edb9fa74d..2e6d788a4c2085b086a045c27a9f4dd589d7e0ea 100644 --- a/core/IP.php +++ b/core/IP.php @@ -48,6 +48,8 @@ if(Piwik_Common::isWindows() || !function_exists('inet_pton')) { */ class Piwik_IP { + const MAPPED_IPv4_START = '::ffff:'; + /** * Sanitize human-readable IP address. * @@ -254,6 +256,37 @@ class Piwik_IP return '0.0.0.0'; } + + /** + * Returns true if $ip is an IPv6 address, false if otherwise. This function does + * a naive check. It assumes that whatever format $ip is in, it is well-formed. + * + * @param string $ip + * @return bool + */ + static public function isIPv6( $ip ) + { + return strpos($ip, ':') !== false; + } + + /** + * Returns true if $ip is a IPv4 mapped address, false if otherwise. + * + * @param string $ip + * @return bool + */ + static public function isMappedIPv4($ip) + { + return substr($ip, 0, strlen(self::MAPPED_IPv4_START)) === self::MAPPED_IPv4_START; + } + + /** + * Returns + */ + static public function getIPv4FromMappedIPv6($ip) + { + return substr($ip, strlen(self::MAPPED_IPv4_START)); + } /** * Get low and high IP addresses for a specified range. diff --git a/lang/en.php b/lang/en.php index 32394769a5b4c10c13327b251071ee411e6757be..b197f5c2b08dc94ca8dd85f71556903ae6135363 100644 --- a/lang/en.php +++ b/lang/en.php @@ -348,6 +348,7 @@ $translations = array( 'General_Broken' => 'Broken', 'General_InfoFor' => 'Info for %s', 'General_Add' => 'Add', + 'General_Note' => 'Note', 'Actions_PluginDescription' => 'Reports about the page views, the outlinks and downloads. Outlinks and Downloads tracking is automatic! You can also track your internal website\'s Search Engine.', 'Actions_Actions' => 'Actions', 'Actions_SubmenuPages' => 'Pages', @@ -1218,6 +1219,7 @@ And thank you for using Piwik!', 'UserCountry_City' => 'City', 'UserCountry_Latitude' => 'Latitude', 'UserCountry_Longitude' => 'Longitude', + 'UserCountry_Organization' => 'Organization', 'UserCountry_DistinctCountries' => '%s distinct countries', 'UserCountry_Location' => 'Location', 'UserCountry_Geolocation' => 'Geolocation', @@ -1524,6 +1526,7 @@ And thank you for using Piwik!', 'UserCountry_PeclGeoLiteError' => 'Your GeoIP database in %1$s is named %2$s. Unfortunately, the PECL module will not recognize it with this name. Please rename it to %3$s.', 'UserCountry_GeoIpLocationProviderDesc_Pecl1' => 'This location provider uses a GeoIP database and a PECL module to accurately and efficiently determine the location of your visitors.', 'UserCountry_GeoIpLocationProviderDesc_Pecl2' => 'There are no limitations with this provider, so it is the one we recommend using. ', + 'UserCountry_GeoIPImplHasAccessTo' => 'This GeoIP implementation has access to the following types of databases', 'UserCountry_CannotFindGeoIPServerVar' => 'The %s variable is not set. Your server may not be configured correctly.', 'UserCountry_GeoIPCannotFindMbstringExtension' => 'Cannot find the %1$s function. Please make sure the %2$s extension is installed and loaded.', 'UserCountry_LocationProvider' => 'Location Provider', @@ -1541,7 +1544,12 @@ And thank you for using Piwik!', 'UserCountry_getCityDocumentation' => 'This report shows the cities your visitors were in when they accessed your website.', 'UserCountry_GeoIPDocumentationSuffix' => 'In order to see data for this report, you must setup GeoIP in the Geolocation admin tab. The commercial %1$sMaxmind%2$s GeoIP databases are more accurate than the free ones. To see how accurate they are, click %3$shere%4$s.', 'UserCountry_OldGeoIPWarning' => 'We\'ve detected the old GeoIP plugin. GeoIP integration is now in Piwik core and this plugin is considered deprecated. New region and city reports will not be shown while this plugin is loaded. %1$sPlease disable the plugin%2$s and %3$sconfigure GeoIP%4$s. If you want location data for your old visits, use the script described %5$shere%6$s then %7$sreprocess your reports%8$s.', - 'UserCountry_NoDataForGeoIPReport' => 'There is no data for this report because there is no location data available. To enable accurate geolocation, change the settings %1$shere%2$s. To get location data for your old visits, use the script described %3$shere%4$s.', + 'UserCountry_NoDataForGeoIPReport' => 'There is no data for this report because there is no location data available. To enable accurate geolocation, change the settings %1$shere%2$s and use a %3$scity level database%4$s. To get location data for your old visits, use the script described %5$shere%6$s.', + 'UserCountry_GeoIPPeclCustomDirNotSet' => 'The %s PHP ini option is not set.', + 'UserCountry_GeoIPServerVarsFound' => 'Piwik detects the following GeoIP %s variables', + 'UserCountry_AssumingNonApache' => "Cannot find apache_get_modules function, assuming non-Apache webserver.", + 'UserCountry_FoundApacheModules' => 'Piwik found the following Apache modules', + 'UserCountry_GeoIPNoServerVars' => 'Piwik cannot find any GeoIP %s variables.', 'UserSettings_VisitorSettings' => 'Visitor Settings', 'UserSettings_BrowserFamilies' => 'Browser families', 'UserSettings_Browsers' => 'Browsers', diff --git a/plugins/UserCountry/Controller.php b/plugins/UserCountry/Controller.php index 8d477d7f014dab2a25fd66d4fdb1a24d98cf2ed0..e7ed5c458a03111f3ba065dad876673e472eb061 100644 --- a/plugins/UserCountry/Controller.php +++ b/plugins/UserCountry/Controller.php @@ -229,6 +229,8 @@ class Piwik_UserCountry_Controller extends Piwik_Controller $footerMessage = Piwik_Translate('UserCountry_NoDataForGeoIPReport', array( '<a target="_blank" href="'.Piwik_Url::getCurrentQueryStringWithParametersModified($params).'">', '</a>', + '<a target="_blank" href="http://dev.maxmind.com/geoip/geolite?rId=piwik">', + '</a>', '<a target="_blank" href="http://piwik.org/faq/how-to/#faq_167">', '</a>' )); diff --git a/plugins/UserCountry/LocationProvider.php b/plugins/UserCountry/LocationProvider.php index 744bc24fe19a3ab998425b83a38f470614637b03..f2cc40cd2d7e276590f96000f37b92669da533bf 100755 --- a/plugins/UserCountry/LocationProvider.php +++ b/plugins/UserCountry/LocationProvider.php @@ -213,9 +213,14 @@ abstract class Piwik_UserCountry_LocationProvider $location = false; $statusMessage = false; - if (!$provider->isAvailable()) + $availableOrMessage = $provider->isAvailable(); + if ($availableOrMessage !== true) { $status = self::NOT_INSTALLED; + if (is_string($availableOrMessage)) + { + $statusMessage = $availableOrMessage; + } } else { @@ -446,18 +451,41 @@ abstract class Piwik_UserCountry_LocationProvider { $lines[] = ''; - if (!empty($locationInfo[self::ORG_KEY])) - { - $lines[] = "Org: ".$locationInfo[self::ORG_KEY]; - } + $unknown = Piwik_Translate('General_Unknown'); - if (!empty($locationInfo[self::ISP_KEY])) - { - $lines[] = "ISP: ".$locationInfo[self::ISP_KEY]; - } + $org = !empty($locationInfo[self::ORG_KEY]) ? $locationInfo[self::ORG_KEY] : $unknown; + $lines[] = "Org: $org"; + + $isp = !empty($locationInfo[self::ISP_KEY]) ? $locationInfo[self::ISP_KEY] : $unknown; + $lines[] = "ISP: $isp"; } return implode($newline, $lines); } + + /** + * Returns an IP address from an array that was passed into getLocation. This + * will return an IPv4 address or false if the address is IPv6 (IPv6 is not + * supported yet). + * + * @param array $ip Must have 'ip' key. + * @return string|bool + */ + protected function getIpFromInfo( $info ) + { + $ip = $info['ip']; + if (Piwik_IP::isMappedIPv4($ip)) + { + return Piwik_IP::getIPv4FromMappedIPv6($ip); + } + else if (Piwik_IP::isIPv6($ip)) // IPv6 is not supported (yet) + { + return false; + } + else + { + return $ip; + } + } } diff --git a/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php b/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php index 06789ce8f1c89e6583af4ef5a0776314795d09df..0ddf8e2c1dd404d272d780ca972c8e6d9804eac9 100755 --- a/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php +++ b/plugins/UserCountry/LocationProvider/GeoIp/Pecl.php @@ -47,7 +47,7 @@ class Piwik_UserCountry_LocationProvider_GeoIp_Pecl extends Piwik_UserCountry_Lo */ public function getLocation( $info ) { - $ip = $info['ip']; + $ip = $this->getIpFromInfo($info); $result = array(); @@ -237,10 +237,53 @@ class Piwik_UserCountry_LocationProvider_GeoIp_Pecl extends Piwik_UserCountry_Lo . Piwik_Translate('UserCountry_HowToInstallGeoIpPecl') . '</a>' . '</em>'; + + $extraMessage = false; + if ($this->isAvailable()) + { + $peclDir = ini_get('geoip.custom_directory'); + if ($peclDir === false) + { + $extraMessage = Piwik_Translate('UserCountry_GeoIPPeclCustomDirNotSet', "'geoip.custom_directory'"); + } + else + { + $extraMessage = 'The \'geoip.custom_directory\' PHP ini option is set to \''.$peclDir.'\'.'; + } + + $availableDatabaseTypes = array(); + if (self::isCityDatabaseAvailable()) + { + $availableDatabaseTypes[] = Piwik_Translate('UserCountry_City'); + } + if (self::isRegionDatabaseAvailable()) + { + $availableDatabaseTypes[] = Piwik_Translate('UserCountry_Region'); + } + if (self::isCountryDatabaseAvailable()) + { + $availableDatabaseTypes[] = Piwik_Translate('UserCountry_Country'); + } + if (self::isISPDatabaseAvailable()) + { + $availableDatabaseTypes[] = 'ISP'; + } + if (self::isOrgDatabaseAvailable()) + { + $availableDatabaseTypes[] = Piwik_Translate('UserCountry_Organization'); + } + + $extraMessage .= '<br/><br/>'.Piwik_Translate('UserCountry_GeoIPImplHasAccessTo').': <strong><em>' + . implode(', ', $availableDatabaseTypes).'</em></strong>.'; + + $extraMessage = '<strong><em>'.Piwik_Translate('General_Note').': </em></strong>'.$extraMessage; + } + return array('id' => self::ID, 'title' => self::TITLE, 'description' => $desc, 'install_docs' => $installDocs, + 'extra_message' => $extraMessage, 'order' => 3); } diff --git a/plugins/UserCountry/LocationProvider/GeoIp/Php.php b/plugins/UserCountry/LocationProvider/GeoIp/Php.php index 5696029ad4ae33fd976a2d6a6a4ed080b592f853..63c9e1eb1a53198aacdfe6ce5dd7f9078ad42f69 100755 --- a/plugins/UserCountry/LocationProvider/GeoIp/Php.php +++ b/plugins/UserCountry/LocationProvider/GeoIp/Php.php @@ -57,7 +57,7 @@ class Piwik_UserCountry_LocationProvider_GeoIp_Php extends Piwik_UserCountry_Loc */ public function getLocation( $info ) { - $ip = $info['ip']; + $ip = $this->getIpFromInfo($info); $result = array(); @@ -253,10 +253,38 @@ class Piwik_UserCountry_LocationProvider_GeoIp_Php extends Piwik_UserCountry_Loc $installDocs = '<em><a target="_blank" href="http://piwik.org/faq/how-to/#faq_163">' . Piwik_Translate('UserCountry_HowToInstallGeoIPDatabases') . '</em></a>'; + + $availableDatabaseTypes = array(); + if (self::getPathToGeoIpDatabase(array('GeoIPCity.dat', 'GeoLiteCity.dat')) !== false) + { + $availableDatabaseTypes[] = Piwik_Translate('UserCountry_City'); + } + if (self::getPathToGeoIpDatabase(array('GeoIPRegion.dat')) !== false) + { + $availableDatabaseTypes[] = Piwik_Translate('UserCountry_Region'); + } + if (self::getPathToGeoIpDatabase(array('GeoIPCountry.dat')) !== false) + { + $availableDatabaseTypes[] = Piwik_Translate('UserCountry_Country'); + } + if (self::getPathToGeoIpDatabase(array('GeoIPISP.dat')) !== false) + { + $availableDatabaseTypes[] = 'ISP'; + } + if (self::getPathToGeoIpDatabase(array('GeoIPOrg.dat')) !== false) + { + $availableDatabaseTypes[] = Piwik_Translate('UserCountry_Organization'); + } + + $extraMessage = '<strong><em>'.Piwik_Translate('General_Note').'</em></strong>: ' + . Piwik_Translate('UserCountry_GeoIPImplHasAccessTo').': <strong><em>' + . implode(', ', $availableDatabaseTypes).'</em></strong>.'; + return array('id' => self::ID, 'title' => self::TITLE, 'description' => $desc, 'install_docs' => $installDocs, + 'extra_message' => $extraMessage, 'order' => 2); } diff --git a/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php b/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php index b5c92ce1100a12a2875b3c8e5a07b3c023b6eb14..a5f580530ce763eb446aa0cb1f66451371f01822 100755 --- a/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php +++ b/plugins/UserCountry/LocationProvider/GeoIp/ServerBased.php @@ -61,10 +61,12 @@ class Piwik_UserCountry_LocationProvider_GeoIp_ServerBased extends Piwik_UserCou */ public function getLocation( $info ) { + $ip = $this->getIpFromInfo($info); + // geoip modules that are built into servers can't use a forced IP. in this case we try // to fallback to another version. $myIP = Piwik_IP::getIpFromHeader(); - if (!self::isSameOrAnonymizedIp($info['ip'], $myIP) + if (!self::isSameOrAnonymizedIp($ip, $myIP) && (!isset($info['disable_fallbacks']) || !$info['disable_fallbacks'])) { @@ -136,7 +138,7 @@ class Piwik_UserCountry_LocationProvider_GeoIp_ServerBased extends Piwik_UserCou * There's a special check for the Apache module, but we can't check specifically * for anything else. * - * @return bool + * @return bool|string */ public function isAvailable() { @@ -152,8 +154,30 @@ class Piwik_UserCountry_LocationProvider_GeoIp_ServerBased extends Piwik_UserCou } } - return !empty($_SERVER[self::TEST_SERVER_VAR]) - || !empty($_SERVER[self::TEST_SERVER_VAR_ALT]); + $available = !empty($_SERVER[self::TEST_SERVER_VAR]) + || !empty($_SERVER[self::TEST_SERVER_VAR_ALT]); + + if ($available) + { + return true; + } + else // if not available return message w/ extra info + { + if (!function_exists('apache_get_modules')) + { + return Piwik_Translate('General_Note').': '.Piwik_Translate('UserCountry_AssumingNonApache'); + } + + $message = "<strong><em>".Piwik_Translate('General_Note').': ' + . Piwik_Translate('UserCountry_FoundApacheModules') + . "</em></strong>:<br/><br/>\n<ul style=\"list-style:disc;margin-left:24px\">\n"; + foreach (apache_get_modules() as $name) + { + $message .= "<li>$name</li>\n"; + } + $message .= "</ul>"; + return $message; + } } /** @@ -209,11 +233,36 @@ class Piwik_UserCountry_LocationProvider_GeoIp_ServerBased extends Piwik_UserCou . Piwik_Translate('UserCountry_HowToInstallNginxModule') . '</a></em>'; + $geoipServerVars = array(); + foreach ($_SERVER as $key => $value) + { + if (strpos($key, 'GEOIP') === 0) + { + $geoipServerVars[] = $key; + } + } + + if (empty($geoipServerVars)) + { + $extraMessage = '<strong><em>'.Piwik_Translate('UserCountry_GeoIPNoServerVars', '$_SERVER').'</em></strong>'; + } + else + { + $extraMessage = '<strong><em>'.Piwik_Translate('UserCountry_GeoIPServerVarsFound', '$_SERVER') + .":</em></strong><br/><br/>\n<ul style=\"list-style:disc;margin-left:24px\">\n"; + foreach ($geoipServerVars as $key) + { + $extraMessage .= '<li>'.$key."</li>\n"; + } + $extraMessage .= '</ul>'; + } + return array('id' => self::ID, 'title' => $title, 'description' => $desc, 'order' => 4, - 'install_docs' => $installDocs); + 'install_docs' => $installDocs, + 'extra_message' => $extraMessage); } /** diff --git a/plugins/UserCountry/templates/adminIndex.tpl b/plugins/UserCountry/templates/adminIndex.tpl index 4362dae5c7438f06c9e950dffaf1afcabd8a0c97..a4ddcfa9bc6a80c6c16fb6fe209b549eabe119c4 100755 --- a/plugins/UserCountry/templates/adminIndex.tpl +++ b/plugins/UserCountry/templates/adminIndex.tpl @@ -73,12 +73,20 @@ {/if} {/capture} {$currentLocation|inlineHelp} - {elseif $provider.status eq 2} + {/if} + {if isset($provider.statusMessage) && $provider.statusMessage} {capture assign=brokenReason} - <strong><em>{'General_Error'|translate}:</strong></em> {$provider.statusMessage} + {if $provider.status eq 2}<strong><em>{'General_Error'|translate}:</strong></em> {/if}{$provider.statusMessage} {/capture} {$brokenReason|inlineHelp} {/if} + {if isset($provider.extra_message) && $provider.extra_message} + {capture assign=extraMessage} + {$provider.extra_message} + {/capture} + <br/> + {$extraMessage|inlineHelp} + {/if} </td> {/foreach} </table> diff --git a/tests/PHPUnit/Integration/ManyVisitorsOneWebsiteTest.php b/tests/PHPUnit/Integration/ManyVisitorsOneWebsiteTest.php index ccd5df01b1572e324234550437427bb4dd493c3c..fd4e07d025b50b15c07dcc2216f37d3dc3f609d3 100755 --- a/tests/PHPUnit/Integration/ManyVisitorsOneWebsiteTest.php +++ b/tests/PHPUnit/Integration/ManyVisitorsOneWebsiteTest.php @@ -25,11 +25,13 @@ class Test_Piwik_Integration_ManyVisitorsOneWebsiteTest extends IntegrationTestC public static $ips = array( '194.57.91.215', // in Besançon, FR (unicode city name) - '137.82.130.49', // in British Columbia + '::ffff:137.82.130.49', // in British Columbia (mapped ipv4) '137.82.130.0', // anonymization tests '137.82.0.0', + '2001:db8:85a3:0:0:8a2e:370:7334', // ipv6 (not supported) + '151.100.101.92', // in Rome, Italy (using country DB, so only Italy will show) '103.29.196.229', // in Indonesia (Bali), (only Indonesia will show up) @@ -47,7 +49,7 @@ class Test_Piwik_Integration_ManyVisitorsOneWebsiteTest extends IntegrationTestC self::setLocationProvider('GeoIPCity.dat'); self::trackVisits(2, true, $useLocal = false); - self::trackVisits(2, true, $useLocal = false, $doBulk = true); + self::trackVisits(3, true, $useLocal = false, $doBulk = true); self::setLocationProvider('GeoIP.dat'); self::trackVisits(2, true); diff --git a/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getCity_month.xml b/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getCity_month.xml index 91f179e4857b67277ea8e496eb92908c23eadd10..91ab989032ad55a3d79e8f67e0b677b7fe61bc18 100755 --- a/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getCity_month.xml +++ b/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getCity_month.xml @@ -2,21 +2,21 @@ <result> <row> <label>Unknown</label> - <nb_visits>6</nb_visits> - <nb_actions>6</nb_actions> + <nb_visits>8</nb_visits> + <nb_actions>8</nb_actions> <max_actions>1</max_actions> <sum_visit_length>0</sum_visit_length> - <bounce_count>6</bounce_count> + <bounce_count>8</bounce_count> <goals> <row idgoal='1'> - <nb_conversions>6</nb_conversions> - <nb_visits_converted>6</nb_visits_converted> - <revenue>30</revenue> + <nb_conversions>8</nb_conversions> + <nb_visits_converted>8</nb_visits_converted> + <revenue>40</revenue> </row> </goals> - <nb_conversions>6</nb_conversions> - <revenue>30</revenue> - <sum_daily_nb_uniq_visitors>3</sum_daily_nb_uniq_visitors> + <nb_conversions>8</nb_conversions> + <revenue>40</revenue> + <sum_daily_nb_uniq_visitors>4</sum_daily_nb_uniq_visitors> <city_name>Unknown</city_name> <region>xx</region> <country>xx</country> diff --git a/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getContinent_month.xml b/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getContinent_month.xml index fd65c08387ae1d5d7e405ac55d4df50d1fb60665..6a7449fde3de922f11dd26862637d35f616e670d 100755 --- a/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getContinent_month.xml +++ b/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getContinent_month.xml @@ -2,21 +2,21 @@ <result> <row> <label>Europe</label> - <nb_visits>20</nb_visits> - <nb_actions>20</nb_actions> + <nb_visits>22</nb_visits> + <nb_actions>22</nb_actions> <max_actions>1</max_actions> <sum_visit_length>0</sum_visit_length> - <bounce_count>20</bounce_count> + <bounce_count>22</bounce_count> <goals> <row idgoal='1'> - <nb_conversions>20</nb_conversions> - <nb_visits_converted>20</nb_visits_converted> - <revenue>100</revenue> + <nb_conversions>22</nb_conversions> + <nb_visits_converted>22</nb_visits_converted> + <revenue>110</revenue> </row> </goals> - <nb_conversions>20</nb_conversions> - <revenue>100</revenue> - <sum_daily_nb_uniq_visitors>10</sum_daily_nb_uniq_visitors> + <nb_conversions>22</nb_conversions> + <revenue>110</revenue> + <sum_daily_nb_uniq_visitors>11</sum_daily_nb_uniq_visitors> <code>Europe</code> </row> <row> diff --git a/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getCountry_month.xml b/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getCountry_month.xml index c8bc14ea424c4736f2220afe419a3e890ce1562b..55a6de0d070db9e7f228a3982e386a3acc9c07c4 100755 --- a/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getCountry_month.xml +++ b/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getCountry_month.xml @@ -45,7 +45,7 @@ <logoHeight>11</logoHeight> </row> <row> - <label>Russian Federation</label> + <label>France</label> <nb_visits>4</nb_visits> <nb_actions>4</nb_actions> <max_actions>1</max_actions> @@ -61,30 +61,30 @@ <nb_conversions>4</nb_conversions> <revenue>20</revenue> <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors> - <code>ru</code> - <logo>plugins/UserCountry/flags/ru.png</logo> + <code>fr</code> + <logo>plugins/UserCountry/flags/fr.png</logo> <logoWidth>16</logoWidth> <logoHeight>11</logoHeight> </row> <row> - <label>France</label> - <nb_visits>2</nb_visits> - <nb_actions>2</nb_actions> + <label>Russian Federation</label> + <nb_visits>4</nb_visits> + <nb_actions>4</nb_actions> <max_actions>1</max_actions> <sum_visit_length>0</sum_visit_length> - <bounce_count>2</bounce_count> + <bounce_count>4</bounce_count> <goals> <row idgoal='1'> - <nb_conversions>2</nb_conversions> - <nb_visits_converted>2</nb_visits_converted> - <revenue>10</revenue> + <nb_conversions>4</nb_conversions> + <nb_visits_converted>4</nb_visits_converted> + <revenue>20</revenue> </row> </goals> - <nb_conversions>2</nb_conversions> - <revenue>10</revenue> - <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> - <code>fr</code> - <logo>plugins/UserCountry/flags/fr.png</logo> + <nb_conversions>4</nb_conversions> + <revenue>20</revenue> + <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors> + <code>ru</code> + <logo>plugins/UserCountry/flags/ru.png</logo> <logoWidth>16</logoWidth> <logoHeight>11</logoHeight> </row> diff --git a/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getRegion_month.xml b/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getRegion_month.xml index f05ac26adeb3dbcd5d75c088cf540e7ca953b812..830b01300fa07df9633594d8998744dc18419b07 100755 --- a/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getRegion_month.xml +++ b/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getRegion_month.xml @@ -2,21 +2,21 @@ <result> <row> <label>Unknown</label> - <nb_visits>6</nb_visits> - <nb_actions>6</nb_actions> + <nb_visits>8</nb_visits> + <nb_actions>8</nb_actions> <max_actions>1</max_actions> <sum_visit_length>0</sum_visit_length> - <bounce_count>6</bounce_count> + <bounce_count>8</bounce_count> <goals> <row idgoal='1'> - <nb_conversions>6</nb_conversions> - <nb_visits_converted>6</nb_visits_converted> - <revenue>30</revenue> + <nb_conversions>8</nb_conversions> + <nb_visits_converted>8</nb_visits_converted> + <revenue>40</revenue> </row> </goals> - <nb_conversions>6</nb_conversions> - <revenue>30</revenue> - <sum_daily_nb_uniq_visitors>3</sum_daily_nb_uniq_visitors> + <nb_conversions>8</nb_conversions> + <revenue>40</revenue> + <sum_daily_nb_uniq_visitors>4</sum_daily_nb_uniq_visitors> <region>xx</region> <country>xx</country> <country_name>Unknown</country_name> diff --git a/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest_segment_continent__UserCountry.getCountry_month.xml b/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest_segment_continent__UserCountry.getCountry_month.xml index 0a7e4b07ff6f85181493a2de97130d6d253c9788..bce572ec538855a16ac9f828ff46d4910eccd1cb 100755 --- a/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest_segment_continent__UserCountry.getCountry_month.xml +++ b/tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest_segment_continent__UserCountry.getCountry_month.xml @@ -23,7 +23,7 @@ <logoHeight>11</logoHeight> </row> <row> - <label>Russian Federation</label> + <label>France</label> <nb_visits>4</nb_visits> <nb_actions>4</nb_actions> <max_actions>1</max_actions> @@ -39,30 +39,30 @@ <nb_conversions>4</nb_conversions> <revenue>20</revenue> <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors> - <code>ru</code> - <logo>plugins/UserCountry/flags/ru.png</logo> + <code>fr</code> + <logo>plugins/UserCountry/flags/fr.png</logo> <logoWidth>16</logoWidth> <logoHeight>11</logoHeight> </row> <row> - <label>France</label> - <nb_visits>2</nb_visits> - <nb_actions>2</nb_actions> + <label>Russian Federation</label> + <nb_visits>4</nb_visits> + <nb_actions>4</nb_actions> <max_actions>1</max_actions> <sum_visit_length>0</sum_visit_length> - <bounce_count>2</bounce_count> + <bounce_count>4</bounce_count> <goals> <row idgoal='1'> - <nb_conversions>2</nb_conversions> - <nb_visits_converted>2</nb_visits_converted> - <revenue>10</revenue> + <nb_conversions>4</nb_conversions> + <nb_visits_converted>4</nb_visits_converted> + <revenue>20</revenue> </row> </goals> - <nb_conversions>2</nb_conversions> - <revenue>10</revenue> - <sum_daily_nb_uniq_visitors>1</sum_daily_nb_uniq_visitors> - <code>fr</code> - <logo>plugins/UserCountry/flags/fr.png</logo> + <nb_conversions>4</nb_conversions> + <revenue>20</revenue> + <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors> + <code>ru</code> + <logo>plugins/UserCountry/flags/ru.png</logo> <logoWidth>16</logoWidth> <logoHeight>11</logoHeight> </row>