analyzer

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer struct {
	// contains filtered or unexported fields
}

Analyzer runs read-only stats queries against kiko_hits and aggregate tables.

func New

func New(db *sql.DB, driver string) *Analyzer

New attaches an Analyzer to an open SQL store.

func (*Analyzer) Browsers

func (a *Analyzer) Browsers(ctx context.Context, q Query) ([]Row, error)

func (*Analyzer) Channels

func (a *Analyzer) Channels(ctx context.Context, q Query) ([]Row, error)

func (*Analyzer) OS

func (a *Analyzer) OS(ctx context.Context, q Query) ([]Row, error)

func (*Analyzer) Paths

func (a *Analyzer) Paths(ctx context.Context, q Query) ([]PathRow, error)

func (*Analyzer) Refs

func (a *Analyzer) Refs(ctx context.Context, q Query) ([]RefRow, error)

func (*Analyzer) Summary

func (a *Analyzer) Summary(ctx context.Context, q Query) (Summary, error)

func (*Analyzer) Timeline

func (a *Analyzer) Timeline(ctx context.Context, q Query) ([]TimelinePoint, error)

func (*Analyzer) UTMSources

func (a *Analyzer) UTMSources(ctx context.Context, q Query) ([]Row, error)

func (*Analyzer) Visitors

func (a *Analyzer) Visitors(ctx context.Context, q Query) (Visitors, error)

type PathRow

type PathRow struct {
	Path    string `json:"path"`
	Title   string `json:"title,omitempty"`
	Hits    int64  `json:"hits"`
	Uniques int64  `json:"uniques"`
}

PathRow is a path with hit counts.

type Query

type Query struct {
	Host     string
	Since    time.Time
	Until    time.Time
	Limit    int
	Interval string // hour or day
}

Query holds common filter parameters for stats endpoints.

func ParseQuery

func ParseQuery(v url.Values) (Query, error)

ParseQuery builds Query from URL values.

type RefRow

type RefRow struct {
	Referrer string `json:"referrer"`
	Source   string `json:"source,omitempty"`
	Hits     int64  `json:"hits"`
	Uniques  int64  `json:"uniques"`
}

RefRow is a referrer with hit counts.

type Row

type Row struct {
	Label   string `json:"label"`
	Hits    int64  `json:"hits"`
	Uniques int64  `json:"uniques"`
}

Row is a labeled count pair used in breakdown tables.

type Summary

type Summary struct {
	Host     string `json:"host"`
	Since    string `json:"since"`
	Until    string `json:"until"`
	Hits     int64  `json:"hits"`
	Uniques  int64  `json:"uniques"`
	TopPath  string `json:"top_path,omitempty"`
	TopPathN int64  `json:"top_path_hits,omitempty"`
}

Summary holds headline metrics for a site.

type TimelinePoint

type TimelinePoint struct {
	Period  string `json:"period"`
	Hits    int64  `json:"hits"`
	Uniques int64  `json:"uniques"`
}

TimelinePoint is one bucket in a time series.

type Visitors

type Visitors struct {
	Host    string `json:"host"`
	Since   string `json:"since"`
	Until   string `json:"until"`
	Uniques int64  `json:"uniques"`
}

Visitors holds unique visitor count for a range.

Jump to

Keyboard shortcuts

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