Documentation
¶
Overview ¶
Package goal stores named conversion goals — "what counts as success on this site" — defined once, reusable everywhere. A goal is either an event name (signup) or a path glob (/thanks*, matched against $pageview paths). Resolution answers the founder question: how many unique users converted, at what rate, and which channel sent them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Definition ¶
type Definition struct {
ID string `json:"id"`
Name string `json:"name"`
Kind string `json:"kind"` // "event" | "path"
Value string `json:"value"` // event name, or path glob like /thanks*
Created time.Time `json:"created"`
}
Definition is one named goal.
type Report ¶
type Report struct {
Goal string `json:"goal"`
Kind string `json:"kind"`
Value string `json:"value"`
PeriodDays int `json:"period_days"`
Conversions int `json:"conversions"` // unique users who hit the goal
Visitors int `json:"visitors"` // unique users seen in the period
ConversionPct int `json:"conversion_pct"` // conversions / visitors
ByReferrer []Row `json:"by_referrer"` // which channel sent the converters
ByUTMSource []Row `json:"by_utm_source"` // campaign attribution when tagged
}
Report is a resolved goal over a period.
func Resolve ¶
Resolve computes the goal report over the trailing period. Attribution is first-touch within the period: a converter's channel is the referrer/utm_source on their FIRST event in the window — the founder question is "which channel brought the people who converted", not "what page were they on when they did".
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) List ¶
func (s *Store) List() []Definition
func (*Store) Save ¶
func (s *Store) Save(d Definition) (Definition, error)