Enable Statistics for a Subwiki

Last modified by Eleni Cojocariu on 2026/09/25 02:47

Steps

Store statistics for one subwiki by adding the statistics field to its XWiki.XWikiPreferences object, which is where the Statistics Configuration is decided per wiki, with administration rights on the subwiki.

  1. On the subwiki, open /bin/edit/XWiki/XWikiPreferences?editor=class.
  2. Type statistics in the "Add new property" field, leave the type on "Boolean", and click "Add". The property is added to the class straight away.

    statistics-class-property.png

  3. Open /bin/edit/XWiki/XWikiPreferences?editor=object, expand "Objects of type XWiki.XWikiPreferences" (which is when its fields are loaded), set the statistics field at the end of the list to "Yes", and save.
  4. The field now reads "Yes", and the subwiki stores statistics from its next page view: the field is read on each request, so nothing has to be restarted, unlike a change in xwiki.cfg. Nothing reads those statistics: their only interface, the Statistics Application, has to be installed separately and is no longer maintained.

    statistics-object-enabled.png

FAQ

How do I stop storing statistics for this wiki again?

Set the same field to "No". Setting it back to the empty value instead makes the wiki follow xwiki.stats.default again, which is 0 on a stock instance.

Does the main wiki need the same field?

Only if it should differ from the instance-wide default: a wiki without the field, main or not, follows xwiki.stats.default.

Why does this take two edits?

Because no administration screen creates the statistics field. It has to be added to the XWiki.XWikiPreferences class before it can be set on the object, which is why the class editor comes first and the object editor second.

Does the statistics module have to be enabled for the instance?

Yes, and it is on a stock instance. Only xwiki.stats set to 0 in xwiki.cfg turns statistics off for the whole instance, and then no per-wiki field can turn them back on.

Related

Get Connected