Statistics
What the native statistics count and do not count, the split by language, how to switch them on and how to read the numbers.
What is counted
The site counts, per day and per language:
- page views: an anonymous visitor opens a public page and the answer is an HTML page with status 200,
- article views, for the article shown on the page,
- box appearances, for the boxes shown on the page.
It also keeps totals since counting began. The day is cut in the time zone you set, UTC by default.
What is not counted
- Requests of a logged-in user and pages that need a login.
- Answers other than a normal HTML page: errors, redirects, the API,
/robots.txtand/sitemap.xml. - Anything about the visitor. There are no cookies, no addresses and no identifiers, so there are page views and no unique visitors.
A page view is a request. A robot that loads a page is counted like a person, so the numbers are not a count of people.
By language
Views are recorded with the language of the page that was shown, and the totals are the sum of all languages. A site that records the language needs the database update 6.7.0/013-analytics-locale.sql. Views counted before that update belong to no language: they are in the totals and shown as not recorded per language, and they are never assigned to a language by guess. A site that has not applied the update keeps counting as before, without the split.
Switching it on
- Apply the analytics tables and the language update with
sh bin/update-database.sh(see Deployment). Each file is safe to run again. - Set
analytics.enabledtotrueinSettings.json, and the time zone (analytics.timezone) and the retention (analytics.retentionDays, 62 by default, 31 to 365). See the settings reference. - Run
analytics:prunefrom cron once a day, to remove daily rows older than the retention. - To read the numbers through the API, the Admin or the MCP server, issue a key with the Analytics choice on the Integrations page.
Reading the numbers
- The central Admin has an analytics page per site: totals with the trend, a chart, the most viewed pages, articles and boxes, and the views by language. See Central administration.
- The API returns the overview at
GET /api/v2/analytics/overviewwithfrom,to,granularity(day,week,month) and an optionallocale, for a key with the scopeanalytics:read. See API. - The MCP server gives an assistant the same figures and writes a ready report with the change against the period before.
Limits of the numbers
- Only the ten most viewed items of each list are returned, so a page that is not listed may still have views.
- Counting started on the day it was switched on. A period that starts earlier is marked as incomplete, because earlier days show zero only because nothing was counted.
- Daily rows are kept for the retention period only. A longer period is refused.
- The totals since counting began cover pages and boxes; the article total is the view counter of the articles.