How do I enable « Unique Visitors » metric for Yearly reports and for Custom Date Ranges?
MATOMO ON-PREMISE ONLY
The “Unique Visitors” metric (as well as the “Users” metric) can be found under “Visitors > Overview” in Matomo.
If you’re using Self-hosted Matomo, by default unique visitors metric KPI is processed for days, weeks and months. If you’re using the Matomo Cloud service, unique visitors metric KPI is processed for days and weeks only.
About the « Unique Visitors » column you can see in some reports: when you view a “Day” report, you can also find a “Unique Visitors” column in most reports. For example the number of unique visitors who reached your website from a specific Website Referrer, or the number of unique visitors who use a particular device or browser. This “Unique Visitors” column is only available in « Day » reports and unfortunately it cannot be added in the Week/Month/Year/Custom Date Range reports.
But if you are looking at getting the overall « Unique Visitors » metric (or unique « Users » metric) for Years and Custom Date Ranges, this can be enabled on request. (By default for performance reasons the « Visitors > Overview > Unique Visitors / Users » metrics are disabled because the SQL query to process unique visitors/users is quite costly and take minutes to run on a High traffic Matomo server.)
Note: This document below is written in an assumption that you’re using On-Premise Matomo, if you have any question regarding availability of Unique Visitors or Unique Users metric in Matomo Cloud, please contact our Support team.
You can decide to enable or disable the unique visitors metric for specific periods by adding the following in your config/config.ini.php
:
[General]
enable_processing_unique_visitors_day = 1
enable_processing_unique_visitors_week = 1
enable_processing_unique_visitors_month = 1
enable_processing_unique_visitors_year = 0
enable_processing_unique_visitors_range = 0
By default, unique visitors are processed for days, weeks and months (they are set to 1). You can for example enable yearly unique visitors by setting enable_processing_unique_visitors_year = 1
Important notes:
- processing the Unique Visitors metrics is using the Matomo (Piwik) logs. This requires that the feature « Delete old logs » is not used on your Matomo server.
- after enabling these settings in your configuration file you will need to force Matomo to re-process your historical data as explained in this FAQ.
More information about unique visitors
The number of unique visitors across the month is processed by calculating the number of distinct visitors looking at the logs for the whole month.
When you select a date range, by default there is no unique visitors metric processed by default. And if you sum up the daily unique visitors metric you will not get the total unique visitors across the date range: this is because one visitor may visit the website on several days, and when you sum a number of uniques per day you will end up counting the same visitor multiple times. Therefore to get the number of unique visitors accurately across a date range period, you cannot sum the number of uniques for the sub-periods within and must enable this feature.
Enabling Unique Visitor metrics for the Date Range reports will have a negative impact on the performance of report processing when viewing the Date Range reports in the UI: you may receive a timeout or error. This may cause an « Oops, there was a problem with the request » error in the Matomo interface. This performance impact may be significant if you are analysing a website with more than 1M hits per month. This is because the Date Range reports are not pre-processed and when using the Unique Visitor metric it will cause the Date Range report to process the RAW tracking data (Instead of using the existing « Day » periods)
Advanced
In some rare cases you may want to go through the effort to hard-code one or more static ranges to be available as pre-processed report data. For example, you could hard-code your quarterly dates for the year. In this case, a static date range can be set in the Matomo On Premise configuration file, located at …/matomo/config/config.ini.php. For example, add these under the General heading of the file:
[General]
archiving_custom_ranges[] = "2023-01-01,2023-03-31"
archiving_custom_ranges[] = "2023-04-01,2023-06-30"
archiving_custom_ranges[] = "2023-01-01,2023-06-30"