groups

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: 4 Imported by: 0

Documentation

Overview

Package groups computes account-level (B2B) analytics — aggregate by a group property (company, account_id, team) instead of by user. Answers "which accounts are most active", "how many accounts", "account engagement" — the questions other tools gate behind expensive plans. Deterministic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	Value    string    `json:"value"`
	Events   int       `json:"events"`
	Users    int       `json:"users"`
	LastSeen time.Time `json:"last_seen"`
}

Group is one account: its activity, distinct users, and recency.

type Result

type Result struct {
	Property        string  `json:"property"`
	TotalGroups     int     `json:"total_groups"`
	ActiveGroups7d  int     `json:"active_groups_7d"`
	ActiveGroups30d int     `json:"active_groups_30d"`
	Groups          []Group `json:"groups"`
}

Result is the account roll-up for a group property.

func Compute

func Compute(events []event.Event, property string, asof time.Time, limit int) Result

Compute rolls events up by the group property (events without it are skipped). Groups are returned sorted by event volume; limit<=0 means 50.

Jump to

Keyboard shortcuts

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