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:
authorStefan Giehl <stefan@matomo.org>2020-02-21 11:22:28 +0300
committerGitHub <noreply@github.com>2020-02-21 11:22:28 +0300
commitb25fcee82367e2b6e0df148743591eba1fb8518b (patch)
treef355153d2576bbee9d59b0f56d0bcf93d2fce1b7 /plugins
parent2b64abf72c102cf33d478bbfff31c019adb8389a (diff)
Fix VisitorFrequency.get API for idsites=all (#15601)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitFrequency.get_month.xml36
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_day.xml11
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_year.xml9
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_day.xml11
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_year.xml9
-rw-r--r--plugins/VisitFrequency/API.php5
6 files changed, 79 insertions, 2 deletions
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitFrequency.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitFrequency.get_month.xml
index 2ae3a02ea7..846d5cc107 100644
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitFrequency.get_month.xml
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitFrequency.get_month.xml
@@ -1,6 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<results>
<result idSite="1">
+ <nb_uniq_visitors_new>32</nb_uniq_visitors_new>
+ <nb_users_new>1</nb_users_new>
+ <nb_visits_new>32</nb_visits_new>
+ <nb_actions_new>35</nb_actions_new>
+ <nb_visits_converted_new>30</nb_visits_converted_new>
+ <bounce_count_new>30</bounce_count_new>
+ <sum_visit_length_new>305</sum_visit_length_new>
+ <max_actions_new>3</max_actions_new>
+ <bounce_rate_new>94%</bounce_rate_new>
+ <nb_actions_per_visit_new>1.1</nb_actions_per_visit_new>
+ <avg_time_on_site_new>10</avg_time_on_site_new>
<nb_uniq_visitors_returning>1</nb_uniq_visitors_returning>
<nb_users_returning>0</nb_users_returning>
<nb_visits_returning>1</nb_visits_returning>
@@ -13,8 +24,31 @@
<nb_actions_per_visit_returning>1</nb_actions_per_visit_returning>
<avg_time_on_site_returning>0</avg_time_on_site_returning>
</result>
- <result idSite="2" />
+ <result idSite="2">
+ <nb_uniq_visitors_new>1</nb_uniq_visitors_new>
+ <nb_users_new>0</nb_users_new>
+ <nb_visits_new>1</nb_visits_new>
+ <nb_actions_new>1</nb_actions_new>
+ <nb_visits_converted_new>0</nb_visits_converted_new>
+ <bounce_count_new>1</bounce_count_new>
+ <sum_visit_length_new>0</sum_visit_length_new>
+ <max_actions_new>1</max_actions_new>
+ <bounce_rate_new>100%</bounce_rate_new>
+ <nb_actions_per_visit_new>1</nb_actions_per_visit_new>
+ <avg_time_on_site_new>0</avg_time_on_site_new>
+ </result>
<result idSite="3">
+ <nb_uniq_visitors_new>1</nb_uniq_visitors_new>
+ <nb_users_new>0</nb_users_new>
+ <nb_visits_new>1</nb_visits_new>
+ <nb_actions_new>3</nb_actions_new>
+ <nb_visits_converted_new>0</nb_visits_converted_new>
+ <bounce_count_new>0</bounce_count_new>
+ <sum_visit_length_new>1</sum_visit_length_new>
+ <max_actions_new>3</max_actions_new>
+ <bounce_rate_new>0%</bounce_rate_new>
+ <nb_actions_per_visit_new>3</nb_actions_per_visit_new>
+ <avg_time_on_site_new>1</avg_time_on_site_new>
<nb_uniq_visitors_returning>2</nb_uniq_visitors_returning>
<nb_users_returning>0</nb_users_returning>
<nb_visits_returning>2</nb_visits_returning>
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_day.xml
index c415099916..1d3a02a716 100644
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_day.xml
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_day.xml
@@ -1,5 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
+ <nb_uniq_visitors_new>11</nb_uniq_visitors_new>
+ <nb_users_new>0</nb_users_new>
+ <nb_visits_new>11</nb_visits_new>
+ <nb_actions_new>11</nb_actions_new>
+ <nb_visits_converted_new>11</nb_visits_converted_new>
+ <bounce_count_new>11</bounce_count_new>
+ <sum_visit_length_new>0</sum_visit_length_new>
+ <max_actions_new>1</max_actions_new>
+ <bounce_rate_new>100%</bounce_rate_new>
+ <nb_actions_per_visit_new>1</nb_actions_per_visit_new>
+ <avg_time_on_site_new>0</avg_time_on_site_new>
<nb_uniq_visitors_returning>0</nb_uniq_visitors_returning>
<nb_users_returning>0</nb_users_returning>
<nb_visits_returning>0</nb_visits_returning>
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_year.xml
index 05d0ce3953..8cb0cb910a 100644
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_year.xml
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_year.xml
@@ -1,5 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
+ <nb_visits_new>33</nb_visits_new>
+ <nb_actions_new>45</nb_actions_new>
+ <nb_visits_converted_new>31</nb_visits_converted_new>
+ <bounce_count_new>30</bounce_count_new>
+ <sum_visit_length_new>359</sum_visit_length_new>
+ <max_actions_new>10</max_actions_new>
+ <bounce_rate_new>91%</bounce_rate_new>
+ <nb_actions_per_visit_new>1.4</nb_actions_per_visit_new>
+ <avg_time_on_site_new>11</avg_time_on_site_new>
<nb_visits_returning>1</nb_visits_returning>
<nb_actions_returning>1</nb_actions_returning>
<nb_visits_converted_returning>1</nb_visits_converted_returning>
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_day.xml
index c415099916..1d3a02a716 100644
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_day.xml
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_day.xml
@@ -1,5 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
+ <nb_uniq_visitors_new>11</nb_uniq_visitors_new>
+ <nb_users_new>0</nb_users_new>
+ <nb_visits_new>11</nb_visits_new>
+ <nb_actions_new>11</nb_actions_new>
+ <nb_visits_converted_new>11</nb_visits_converted_new>
+ <bounce_count_new>11</bounce_count_new>
+ <sum_visit_length_new>0</sum_visit_length_new>
+ <max_actions_new>1</max_actions_new>
+ <bounce_rate_new>100%</bounce_rate_new>
+ <nb_actions_per_visit_new>1</nb_actions_per_visit_new>
+ <avg_time_on_site_new>0</avg_time_on_site_new>
<nb_uniq_visitors_returning>0</nb_uniq_visitors_returning>
<nb_users_returning>0</nb_users_returning>
<nb_visits_returning>0</nb_visits_returning>
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_year.xml
index dafefc726a..3e02d8891a 100644
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_year.xml
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_year.xml
@@ -1,5 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
+ <nb_visits_new>33</nb_visits_new>
+ <nb_actions_new>45</nb_actions_new>
+ <nb_visits_converted_new>31</nb_visits_converted_new>
+ <bounce_count_new>30</bounce_count_new>
+ <sum_visit_length_new>359</sum_visit_length_new>
+ <max_actions_new>10</max_actions_new>
+ <bounce_rate_new>91%</bounce_rate_new>
+ <nb_actions_per_visit_new>1.4</nb_actions_per_visit_new>
+ <avg_time_on_site_new>11</avg_time_on_site_new>
<nb_visits_returning>0</nb_visits_returning>
<nb_actions_returning>0</nb_actions_returning>
<nb_visits_converted_returning>0</nb_visits_converted_returning>
diff --git a/plugins/VisitFrequency/API.php b/plugins/VisitFrequency/API.php
index 854b0de5f5..afc93fe636 100644
--- a/plugins/VisitFrequency/API.php
+++ b/plugins/VisitFrequency/API.php
@@ -49,7 +49,10 @@ class API extends \Piwik\Plugin\API
$columns = Piwik::getArrayFromApiParameter($columns);
/** @var \Piwik\DataTable\DataTableInterface $resultSet */
- if (Period::isMultiplePeriod($date, $period)) {
+ if ($idSite === 'all') {
+ $resultSet = new DataTable\Map();
+ $resultSet->setKeyName('idSite');
+ } else if (Period::isMultiplePeriod($date, $period)) {
$resultSet = new DataTable\Map();
$resultSet->setKeyName('period');
} else {