diff --git a/libs/PiwikTracker/PiwikTracker.php b/libs/PiwikTracker/PiwikTracker.php index 8583ee1e062bdd3970482194b1d133ad5f454ace..c6629d4473184df88d31585bdb8a6b2744ffc1ba 100644 --- a/libs/PiwikTracker/PiwikTracker.php +++ b/libs/PiwikTracker/PiwikTracker.php @@ -948,7 +948,7 @@ class PiwikTracker } /** - * The User ID is a string representing a given user in your system. + * Force the action to be recorded for a specific User. The User ID is a string representing a given user in your system. * * A User ID can be a username, UUID or an email address, or any number or string that uniquely identifies a user or client. * diff --git a/plugins/API/ProcessedReport.php b/plugins/API/ProcessedReport.php index e174d3e4a42f0fdf1a1795b28271b9097fc664a1..3111ae5ae913aef098f2b99e182efa7831a01c12 100644 --- a/plugins/API/ProcessedReport.php +++ b/plugins/API/ProcessedReport.php @@ -39,6 +39,7 @@ class ProcessedReport foreach ($reportsMetadata as $report) { // See ArchiveProcessor/Aggregator.php - unique visitors are not processed for period != day + // todo: should use SettingsPiwik::isUniqueVisitorsEnabled instead if (($period && $period != 'day') && !($apiModule == 'VisitsSummary' && $apiAction == 'get')) { unset($report['metrics']['nb_uniq_visitors']); } diff --git a/plugins/CustomVariables/tests/processed/test_CustomVariablesIntegrationTest__Live.getLastVisitsDetails_day.xml b/plugins/CustomVariables/tests/processed/test_CustomVariablesIntegrationTest__Live.getLastVisitsDetails_day.xml index 463462262e435c0673febea7b69ddb72f76eebc5..5d1eec57507d238d3a68a7b4c05d6f8283187442 100644 --- a/plugins/CustomVariables/tests/processed/test_CustomVariablesIntegrationTest__Live.getLastVisitsDetails_day.xml +++ b/plugins/CustomVariables/tests/processed/test_CustomVariablesIntegrationTest__Live.getLastVisitsDetails_day.xml @@ -4,6 +4,7 @@ <idSite>1</idSite> <idVisit>1</idVisit> <visitIp>156.5.3.2</visitIp> + <userId /> <actionDetails> <row> diff --git a/tests/PHPUnit/Impl/TestRequestResponse.php b/tests/PHPUnit/Impl/TestRequestResponse.php index 923e53088e5d4ade3201495961b79483d7eddd34..1f4bae3ebb0532b03eec393b464be313379c1a85 100644 --- a/tests/PHPUnit/Impl/TestRequestResponse.php +++ b/tests/PHPUnit/Impl/TestRequestResponse.php @@ -82,7 +82,7 @@ class TestRequestResponse private function normalizeApiResponse($apiResponse) { if ($this->shouldDeleteLiveIds()) { - $this->removeAllIdsFromXml($apiResponse); + $apiResponse = $this->removeAllIdsFromXml($apiResponse); } if ($this->shouldDeleteLiveDates()) { @@ -225,7 +225,7 @@ class TestRequestResponse private function shouldDeleteLiveIds() { - return empty($this->params['keepLiveDates']); + return empty($this->params['keepLiveIds']); } private function shouldDeleteLiveDates() diff --git a/tests/PHPUnit/Integration/expected/test_apiGetReportMetadata__API.getSegmentsMetadata.xml b/tests/PHPUnit/Integration/expected/test_apiGetReportMetadata__API.getSegmentsMetadata.xml index 19aefaace8f0f09044510d4f299fa93f7eb36429..5b0389fd95b54c2b9388fc44b052a5a54ac45d72 100644 --- a/tests/PHPUnit/Integration/expected/test_apiGetReportMetadata__API.getSegmentsMetadata.xml +++ b/tests/PHPUnit/Integration/expected/test_apiGetReportMetadata__API.getSegmentsMetadata.xml @@ -156,6 +156,14 @@ <segment>visitServerHour</segment> <acceptedValues>0, 1, 2, 3, ..., 20, 21, 22, 23</acceptedValues> </row> + <row> + <type>dimension</type> + <category>Visit</category> + <name>User ID</name> + <segment>userId</segment> + <acceptedValues>any non empty unique string identifying the user (such as an email address or a username).</acceptedValues> + <permission>1</permission> + </row> <row> <type>dimension</type> <category>Visit</category>