Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unique Visitors KPI Metric doesn't display when selecting higher periods #20216

Open
Starker3 opened this issue Jan 16, 2023 · 4 comments
Open
Labels
Bug For errors / faults / flaws / inconsistencies etc.

Comments

@Starker3
Copy link
Contributor

When selecting the KPI Metric for the Dashboard widget, it's possible to select the metric "Unique Visitors":
image

And this works as expected for the Day period, but selecting any other periods such as Week, Month or Year regardless of if the Unique Visitor Metrics are enabled for that period, results in the widget showing no label even though it loads the data and sparklines:
image

The KPI Metric also is not selectable from the drop-down menu when any period other than Day is selected.

@Starker3 Starker3 added Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Jan 16, 2023
@bx80
Copy link
Contributor

bx80 commented Jan 16, 2023

Thanks for reporting this @Starker3, I can recreate this on demo.matomo.cloud and locally on 4.x-dev. It also seems that the 'Unique Visitors' metric is only available for selection when the current period is Day

This is probably caused by this config.ini.php setting:

; the following settings control whether Unique Visitors `nb_uniq_visitors` and Unique 
; users `nb_users` will be processed for different period types.  year and range periods are 
; disabled by default, to ensure optimal performance for high traffic Matomo instances
; if you set it to 1 and want the Unique Visitors to be re-processed for reports in the past, 
; drop all matomo_archive_* tables it is recommended to always enable Unique Visitors 
; and Unique Users processing for 'day' periods
enable_processing_unique_visitors_day = 1
enable_processing_unique_visitors_week = 0
enable_processing_unique_visitors_month = 0
enable_processing_unique_visitors_year = 0
enable_processing_unique_visitors_range = 0

In which case we should explicitly handle the scenario where the unique visitor metric is already displayed in the dashboard KPI widget and then the current period is changed to a period where unique visitor data is not available. Perhaps a warning could then be shown: "Unique visitor data is not available for year periods. For more info read this [faq]"

@bx80 bx80 added Bug For errors / faults / flaws / inconsistencies etc. and removed Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Jan 16, 2023
@bx80 bx80 added this to the For Prioritization milestone Jan 16, 2023
@Starker3
Copy link
Contributor Author

Thanks @bx80
In the case of all Cloud accounts by default the Unique Visitor metrics are enabled for both Day and Week.

In this specific customers case the metric is enabled for the Month period as well, which is why I think that there is some data shown in the Sparkline and the Widget shows some data there.

@bx80
Copy link
Contributor

bx80 commented Jan 16, 2023

It does look like there is a bug here somewhere with displaying the Unique Visitors metric label. Even with enable_processing_unique_visitors_week = 1 set locally, the label is not shown for periods other than Day.

@sgiehl
Copy link
Member

sgiehl commented Jan 17, 2023

That one should be related to this piece of code:

// 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']);
unset($report['metrics']['nb_users']);
}

The todo actually already tells what should be done, but not sure if that would have any other side effects...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

5 participants