engagement

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 2 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL