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.

Constructors

Methods

  • 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
  • Parameters

    • userId: string
    • Optional metadata: UserActivityMetadata
    • Optional dateOverride: Date

    Returns void

Generated using TypeDoc