# About Page Site Statistics Reference Guide

**URL:** https://meta.discourse.org/t/about-page-site-statistics-reference-guide/245984
**Category:** Site Management
**Tags:** reference, reporting
**Created:** [November 18, 2022, 12:00am UTC](https://meta.discourse.org/t/about-page-site-statistics-reference-guide/245984 "2022-11-18T00:00:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [November 18, 2022, 12:00am UTC](https://meta.discourse.org/t/about-page-site-statistics-reference-guide/245984/1 "2022-11-18T00:00:26Z")

</div>

> 🔖 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.
> 
> 🙋 Required user level: All users

# About Page Statistics

All Discourse sites have a built in `/about` page (for example, [here is the about page for Meta](https://meta.discourse.org/about)) that contains a list of admins and moderators for the site along with a few statistics about the site itself.

 ![Example of site statistics on the about page.](https://global.discourse-cdn.com/meta/original/4X/9/9/0/9909edca0d59ef4f24f3366225e2f207fa5edf02.png)

These statistics include all users, including admin and moderator accounts. Some statistics will also include [anonymous accounts](https://meta.discourse.org/t/use-anonymous-mode-to-reply-or-create-topics/240039) (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 retrieved at `/about.json`.

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

> 💎 The Ruby code for the core statistics is located in: [discourse/lib/statistics.rb](https://github.com/discourse/discourse/blob/main/lib/statistics.rb). The `Stat` model that orchestrates core and plugin stats is in [discourse/app/models/stat.rb](https://github.com/discourse/discourse/blob/main/app/models/stat.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 personal messages.

```ruby
topics = Topic.listable_topics

{
  last_day: topics.where("created_at > ?", 1.day.ago).count,
  "7_days": topics.where("created_at > ?", 7.days.ago).count,
  "30_days": topics.where("created_at > ?", 30.days.ago).count,
  count: topics.count,
}

```

# Posts

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

```ruby
{
  last_day: Post.where("created_at > ?", 1.day.ago).count,
  "7_days": Post.where("created_at > ?", 7.days.ago).count,
  "30_days": Post.where("created_at > ?", 30.days.ago).count,
  count: Post.count,
}

```

# Sign-Ups

The number of valid users who have signed up for new accounts within the indicated timeframe. A “valid user” is a `real` user who is also activated, not suspended, and not silenced. If `must approve users` is enabled, only approved users are counted.

```ruby
def self.valid_users
  users = User.real.activated.not_suspended.not_silenced
  users = users.approved if SiteSetting.must_approve_users
  users
end

{
  last_day: valid_users.where("created_at > ?", 1.day.ago).count,
  "7_days": valid_users.where("created_at > ?", 7.days.ago).count,
  "30_days": valid_users.where("created_at > ?", 30.days.ago).count,
  count: valid_users.count,
}

```

> 💎 A `real` user is defined here: [discourse/app/models/user.rb](https://github.com/discourse/discourse/blob/main/app/models/user.rb) — it excludes system/bot users and anonymous user shadow accounts.

# Active Users

The number of valid users who have visited the site within the indicated timeframe. Uses the same `valid_users` filter as Sign-Ups (excludes inactive, suspended, and silenced users). Includes anonymous mode users, but does not include users without an account.

```ruby
{
  last_day: valid_users.where("last_seen_at > ?", 1.day.ago).count,
  "7_days": valid_users.where("last_seen_at > ?", 7.days.ago).count,
  "30_days": valid_users.where("last_seen_at > ?", 30.days.ago).count,
}

```

# Participating Users

The number of valid users who have performed an action (created a topic, post, like, etc.) within the indicated timeframe. If chat is enabled, users who sent chat messages or added chat reactions are also counted.

```ruby
{
  last_day: participating_users_count(1.day.ago),
  "7_days": participating_users_count(7.days.ago),
  "30_days": participating_users_count(30.days.ago),
}

```

> 💎 The full implementation is in [discourse/lib/statistics.rb](https://github.com/discourse/discourse/blob/main/lib/statistics.rb).

# Likes

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

```ruby
likes = UserAction.where(action_type: UserAction::LIKE)

{
  last_day: likes.where("created_at > ?", 1.day.ago).count,
  "7_days": likes.where("created_at > ?", 7.days.ago).count,
  "30_days": likes.where("created_at > ?", 30.days.ago).count,
  count: likes.count,
}

```

# Visitors and EU Visitors

When the `display eu visitor stats` site setting is enabled, the about page will also display estimated visitor counts (total and EU-based). These are calculated by combining logged-in user visit data with estimated anonymous visitors based on page view ratios.

> 💎 See the `visitors` and `eu_visitors` methods in [discourse/lib/statistics.rb](https://github.com/discourse/discourse/blob/main/lib/statistics.rb) for the full calculation.

# Chat Messages

The number of chat messages sent across all chat channels. When chat is enabled, the following statistics are also registered: chat users (distinct users who have sent messages) and chat channels (open channels).

These stats are registered as plugin stats by the chat plugin via `register_stat` in [plugins/chat/plugin.rb](https://github.com/discourse/discourse/blob/main/plugins/chat/plugin.rb). The underlying queries are in [plugins/chat/lib/chat/statistics.rb](https://github.com/discourse/discourse/blob/main/plugins/chat/lib/chat/statistics.rb).

> Last edited by @JammyDodger 2024-08-29T09:46:04Z
> 
> Last checked by @hugh 2024-07-23T11:32:47Z
> 
> > **Check document**
> >
> > Perform check on document:
