Skip to content

feat(analytics): track daily active Discord users #3

Description

@smmariquit

Problem

We have no visibility into how many distinct people use the UPLB Tools Discord server per day — useful for growth, volunteer engagement, and correlating with map/editor contribution spikes.

Goal

Track daily active users (DAU) on the Discord server and expose them to maintainers without violating privacy.

Definitions

  • Active user (day): unique userId with at least one qualifying event that calendar day (Asia/Manila midnight boundary, unless configured otherwise)
  • Qualifying events (v1): sent a message in a text channel, or used a bot slash command, or added a reaction (configurable allowlist)
  • Exclude: bots, webhooks, system messages

Acceptance criteria

  • Persist daily sets: { date: YYYY-MM-DD, userIds: string[] } (Postgres table or existing bot DB)
  • Cron (e.g. 0 16 * * * UTC = 00:00 Manila) finalizes previous day count and stores aggregate { date, dau, uniqueUserIdsCount }
  • Privacy: store only user IDs + date; no message content; retention ≤90 days for raw IDs, aggregates kept longer
  • Opt-out: respect members with a documented role (e.g. @analytics-opt-out) — excluded from counts
  • Maintainer slash command /dau [days] — table or embed: last N days DAU + 7-day average
  • Optional weekly cron post to #development or #stats (env DAU_REPORT_CHANNEL_ID): “DAU yesterday: N (7d avg: M)”
  • Document in docs/discord-server-guide.md what is collected and retention policy

Implementation notes

  • Use events/messageCreate, interactionCreate, messageReactionAdd handlers — debounce per user per day in memory + flush to DB
  • Heroku dyno restart: reload today’s partial set from DB on boot
  • GDPR-ish hygiene: no export of user IDs to public channels; /dau restricted to maintainer role

Non-goals (v1)

  • Per-channel heatmaps
  • Cross-linking Discord users to Room TBA editor accounts (separate issue if needed)

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions