Documentation
¶
Overview ¶
Package engagement computes the standard engagement reports — lifecycle (new/returning/resurrected/dormant) and stickiness (DAU/WAU/MAU) — that every product-analytics tool ships. Deterministic and storage-agnostic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LifecycleDay ¶
type LifecycleDay struct {
Date time.Time `json:"date"`
New int `json:"new"` // first-ever activity today
Returning int `json:"returning"` // active today and yesterday
Resurrected int `json:"resurrected"` // active today, not yesterday, but active before
Dormant int `json:"dormant"` // active yesterday, not today (churned out)
}
LifecycleDay classifies a day's active users (and the churn out of it).
func ComputeLifecycle ¶
func ComputeLifecycle(events []event.Event, days int) []LifecycleDay
ComputeLifecycle returns the last `days` of lifecycle classification (daily).
type Stickiness ¶
type Stickiness struct {
DAU int `json:"dau"`
WAU int `json:"wau"`
MAU int `json:"mau"`
DAUoverMAU float64 `json:"dau_over_mau"`
}
Stickiness is the classic engagement ratio.
func ComputeStickiness ¶
func ComputeStickiness(events []event.Event, asof time.Time) Stickiness
ComputeStickiness counts distinct users active in the trailing 1/7/30 days from asof (defaults to now). DAU/MAU is the stickiness ratio.
Click to show internal directories.
Click to hide internal directories.