About Page Site Statistics Reference Guide

:bookmark: This is a reference guide for describing how the statistics on the /about page are calculated, and where to find the Ruby code for each statistic.

About Page Statistics

All Discourse sites have a built in /about page (Ex: About Page for Meta) that contains a list of admins and moderators for the site along with a few statistics about the site itself.

These statistics include all users, including admin and moderator accounts. Some statistics will also include include anonymous accounts (if enabled on the site).

If the share anonymized statistics site setting is enabled (by default this setting is enabled) the “Site Statistics” on the /about page will be exposed as a json file that can be retrieve at /about.json.

If a site is public, the /about page along with these statistics will be available publicly as well.

:gem: The Ruby Code for all of these statistics is located in: discourse/app/models/about.rb.

Below is a description of how each of these statistics are calculated.

Topics

The number of topics that were created within the indicated timeframe. This statistic does not include unlisted topics or private messages.

topic_count: Topic.listable_topics.count,
topics_last_day: Topic.listable_topics.where('created_at > ?', 1.days.ago).count,
topics_7_days: Topic.listable_topics.where('created_at > ?', 7.days.ago).count,
topics_30_days: Topic.listable_topics.where('created_at > ?', 30.days.ago).count,

Posts

The number of posts that were created within the indicated timeframe. Private messages are included here and counted as regular posts.

post_count: Post.count,
posts_last_day: Post.where('created_at > ?', 1.days.ago).count,
posts_7_days: Post.where('created_at > ?', 7.days.ago).count,
posts_30_days: Post.where('created_at > ?', 30.days.ago).count,

Sign-Ups

The number of users who have signed up for new accounts within the indicated timeframe.

user_count: User.real.count,
users_last_day: User.real.where('created_at > ?', 1.days.ago).count,
users_7_days: User.real.where('created_at > ?', 7.days.ago).count,
users_30_days: User.real.where('created_at > ?', 30.days.ago).count,

:gem: A real user is defined here: discourse/app/models/user.rb

Active Users

The number of users who have visited the site within the indicated timeframe. Includes anonymous users, but does not include users without an account.

active_users_last_day: User.where('last_seen_at > ?', 1.days.ago).count,
active_users_7_days: User.where('last_seen_at > ?', 7.days.ago).count,
active_users_30_days: User.where('last_seen_at > ?', 30.days.ago).count,

Likes

The total number of likes all topics and posts have received within the indicated timeframe.

like_count: UserAction.where(action_type: UserAction::LIKE).count,
likes_last_day: UserAction.where(action_type: UserAction::LIKE).where("created_at > ?", 1.days.ago).count,
likes_7_days: UserAction.where(action_type: UserAction::LIKE).where("created_at > ?", 7.days.ago).count,
likes_30_days: UserAction.where(action_type: UserAction::LIKE).where("created_at > ?", 30.days.ago).count

Chat Messages

The number of chat messages sent across all chat channels.

Note that this statistic will be present regardless of if Discourse Chat has been enabled on a site using the chat enabled site setting.

:information_source: This is a recently added statistic and details about this addition can be found here.

4 Likes