Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UserActivityTracker

Track user activity and produce summaries thereof.

This stores (manually entered through updateUserActivity()) timestamps of user activity, with optional metadata - which is stored once per user, not timestamped, and overwritten upon each update.

Only one timestamp is kept per day, rounded to 12 AM UTC. Only the last 31 timestamps are kept, with older ones being dropped.

In metadata, active is a reserved key that must not be used to not interfere with UserActivityTracker's operations.

Hierarchy

  • UserActivityTracker

Index

Constructors

constructor

Methods

countActiveUsers

  • countActiveUsers(dateNow?: Date): { allUsers: number; privateUsers: number }
  • Return the number of users active within the number of days specified in config.inactiveAfterDays.

    It returns the total number of active users under allUsers in the returned object. privateUsers represents those users with their metadata.private set to true

    Parameters

    • Optional dateNow: Date

    Returns { allUsers: number; privateUsers: number }

    • allUsers: number
    • privateUsers: number

getUserData

updateUserActivity

  • updateUserActivity(userId: string, metadata?: UserActivityMetadata, dateOverride?: Date): void

Generated using TypeDoc