session

package
v0.66.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package session reconstructs a user's journey from events already captured — pages, clicks (with positions), rage-clicks, and timing — and plays it back. It is NOT pixel-perfect DOM replay (that would need a heavy recorder + a separate blob store, breaking the single-binary model); it is an event-based session inspector, computed at query time over the existing event log.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detail

type Detail struct {
	Session
	Steps []Step `json:"steps"`
}

Detail is a session summary plus its ordered playback steps.

func One

func One(evs []event.Event, distinctID string, startUnix int64) (Detail, bool)

One reconstructs one session's playback: the events for distinctID whose session starts at startUnix (from a Sessions() row). Returns ok=false if no such session exists.

type Session

type Session struct {
	DistinctID  string    `json:"distinct_id"`
	Start       time.Time `json:"start"`
	StartUnix   int64     `json:"start_unix"` // stable handle for fetching the detail
	End         time.Time `json:"end"`
	DurationSec int       `json:"duration_sec"`
	Events      int       `json:"events"`
	Pages       int       `json:"pages"` // distinct paths visited
	RageClicks  int       `json:"rage_clicks"`
	EntryPath   string    `json:"entry_path"`
	ExitPath    string    `json:"exit_path"`
}

Session is one visit summary.

func Sessions

func Sessions(evs []event.Event, days, limit int) []Session

Sessions lists recent sessions across users, newest first, capped at limit (0 = 100).

type Step

type Step struct {
	T    int    `json:"t"` // ms since session start
	Name string `json:"name"`
	Path string `json:"path,omitempty"`
	X    int    `json:"x,omitempty"`
	Y    int    `json:"y,omitempty"`
	VW   int    `json:"vw,omitempty"`
	Text string `json:"text,omitempty"`
}

Step is one moment in a session's playback.

Jump to

Keyboard shortcuts

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