analyzer

package
v6.8.5 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// FieldSessionsAll is a query result column.
	FieldSessionsAll = Field{
						// contains filtered or unexported fields
	}

	// FieldPageViewsAll is a query result column.
	FieldPageViewsAll = Field{
						// contains filtered or unexported fields
	}

	// FieldEventsAll is a query result column.
	FieldEventsAll = Field{
					// contains filtered or unexported fields
	}

	// FieldVisitorID is a query result column.
	FieldVisitorID = Field{

		Name: "visitor_id",
		// contains filtered or unexported fields
	}

	// FieldSessionID is a query result column.
	FieldSessionID = Field{

		Name: "session_id",
		// contains filtered or unexported fields
	}

	// FieldCount is a query result column.
	FieldCount = Field{

		Name: "count",
		// contains filtered or unexported fields
	}

	// FieldPath is a query result column.
	FieldPath = Field{

		Name: "path",
		// contains filtered or unexported fields
	}

	// FieldEventPath is a query result column.
	FieldEventPath = Field{

		Name: "path",
		// contains filtered or unexported fields
	}

	// FieldEntryPath is a query result column.
	FieldEntryPath = Field{

		Name: "entry_path",
		// contains filtered or unexported fields
	}

	// FieldEntries is a query result column.
	FieldEntries = Field{

		Name: "entries",
		// contains filtered or unexported fields
	}

	// FieldExitPath is a query result column.
	FieldExitPath = Field{

		Name: "exit_path",
		// contains filtered or unexported fields
	}

	// FieldExits is a query result column.
	FieldExits = Field{

		Name: "exits",
		// contains filtered or unexported fields
	}

	// FieldVisitors is a query result column.
	FieldVisitors = Field{

		Name: "visitors",
		// contains filtered or unexported fields
	}

	// FieldVisitorsRaw is a query result column.
	FieldVisitorsRaw = Field{

		Name: "visitors",
		// contains filtered or unexported fields
	}

	// FieldRelativeVisitors is a query result column.
	FieldRelativeVisitors = Field{

		Name: "relative_visitors",
		// contains filtered or unexported fields
	}

	// FieldCR is a query result column.
	FieldCR = Field{

		Name: "cr",
		// contains filtered or unexported fields
	}

	// FieldCRPeriod is a query result column.
	FieldCRPeriod = Field{

		Name: "cr",
		// contains filtered or unexported fields
	}

	// FieldSessions is a query result column.
	FieldSessions = Field{

		Name: "sessions",
		// contains filtered or unexported fields
	}

	// FieldViews is a query result column.
	FieldViews = Field{

		Name: "views",
		// contains filtered or unexported fields
	}

	// FieldRelativeViews is a query result column.
	FieldRelativeViews = Field{

		Name: "relative_views",
		// contains filtered or unexported fields
	}

	// FieldBounces is a query result column.
	FieldBounces = Field{

		Name: "bounces",
		// contains filtered or unexported fields
	}

	// FieldBounceRate is a query result column.
	FieldBounceRate = Field{

		Name: "bounce_rate",
		// contains filtered or unexported fields
	}

	// FieldReferrer is a query result column.
	FieldReferrer = Field{

		Name: "referrer",
		// contains filtered or unexported fields
	}

	// FieldAnyReferrer is a query result column.
	FieldAnyReferrer = Field{

		Name: "referrer",
		// contains filtered or unexported fields
	}

	// FieldReferrerName is a query result column.
	FieldReferrerName = Field{

		Name: "referrer_name",
		// contains filtered or unexported fields
	}

	// FieldReferrerIcon is a query result column.
	FieldReferrerIcon = Field{

		Name: "referrer_icon",
		// contains filtered or unexported fields
	}

	// FieldLanguage is a query result column.
	FieldLanguage = Field{

		Name: "language",
		// contains filtered or unexported fields
	}

	// FieldCountryCity is a query result column.
	// This field can only be used in combination with the FieldCity.
	FieldCountryCity = Field{

		Name: "country_code",
		// contains filtered or unexported fields
	}

	// FieldCountry is a query result column.
	FieldCountry = Field{

		Name: "country_code",
		// contains filtered or unexported fields
	}

	// FieldCity is a query result column.
	FieldCity = Field{

		Name: "city",
		// contains filtered or unexported fields
	}

	// FieldBrowser is a query result column.
	FieldBrowser = Field{

		Name: "browser",
		// contains filtered or unexported fields
	}

	// FieldBrowserVersion is a query result column.
	FieldBrowserVersion = Field{

		Name: "browser_version",
		// contains filtered or unexported fields
	}

	// FieldOS is a query result column.
	FieldOS = Field{

		Name: "os",
		// contains filtered or unexported fields
	}

	// FieldOSVersion is a query result column.
	FieldOSVersion = Field{

		Name: "os_version",
		// contains filtered or unexported fields
	}

	// FieldScreenClass is a query result column.
	FieldScreenClass = Field{

		Name: "screen_class",
		// contains filtered or unexported fields
	}

	// FieldUTMSource is a query result column.
	FieldUTMSource = Field{

		Name: "utm_source",
		// contains filtered or unexported fields
	}

	// FieldUTMMedium is a query result column.
	FieldUTMMedium = Field{

		Name: "utm_medium",
		// contains filtered or unexported fields
	}

	// FieldUTMCampaign is a query result column.
	FieldUTMCampaign = Field{

		Name: "utm_campaign",
		// contains filtered or unexported fields
	}

	// FieldUTMContent is a query result column.
	FieldUTMContent = Field{

		Name: "utm_content",
		// contains filtered or unexported fields
	}

	// FieldUTMTerm is a query result column.
	FieldUTMTerm = Field{

		Name: "utm_term",
		// contains filtered or unexported fields
	}

	// FieldTagKeysRaw is a query result column.
	FieldTagKeysRaw = Field{

		Name: "tag_keys",
		// contains filtered or unexported fields
	}

	// FieldTagValuesRaw is a query result column.
	FieldTagValuesRaw = Field{

		Name: "tag_values",
		// contains filtered or unexported fields
	}

	// FieldTagKey is a query result column.
	FieldTagKey = Field{

		Name: "key",
		// contains filtered or unexported fields
	}

	// FieldTagValue is a query result column.
	FieldTagValue = Field{

		Name: "value",
		// contains filtered or unexported fields
	}

	// FieldTitle is a query result column.
	FieldTitle = Field{

		Name: "title",
		// contains filtered or unexported fields
	}

	// FieldEventTitle is a query result column.
	FieldEventTitle = Field{

		Name: "title",
		// contains filtered or unexported fields
	}

	// FieldEntryTitle is a query result column.
	FieldEntryTitle = Field{

		Name: "title",
		// contains filtered or unexported fields
	}

	// FieldExitTitle is a query result column.
	FieldExitTitle = Field{

		Name: "title",
		// contains filtered or unexported fields
	}

	// FieldSessionExitTitle is a query result column.
	FieldSessionExitTitle = Field{

		Name: "exit_title",
		// contains filtered or unexported fields
	}

	// FieldTime is a query result column.
	FieldTime = Field{

		Name: "time",
		// contains filtered or unexported fields
	}

	// FieldMaxTime is a query result column.
	FieldMaxTime = Field{

		Name: "max(time)",
		// contains filtered or unexported fields
	}

	// FieldDay is a query result column.
	FieldDay = Field{

		Name: "day",
		// contains filtered or unexported fields
	}

	// FieldHour is a query result column.
	FieldHour = Field{

		Name: "hour",
		// contains filtered or unexported fields
	}

	// FieldMinute is a query result column.
	FieldMinute = Field{

		Name: "minute",
		// contains filtered or unexported fields
	}

	// FieldEventName is a query result column.
	FieldEventName = Field{

		Name: "event_name",
		// contains filtered or unexported fields
	}

	// FieldEventMeta is a query result column.
	FieldEventMeta = Field{

		Name: "meta",
		// contains filtered or unexported fields
	}

	// FieldEventMetaKeys is a query result column.
	FieldEventMetaKeys = Field{

		Name: "meta_keys",
		// contains filtered or unexported fields
	}

	// FieldEventMetaKeysRaw is a query result column.
	FieldEventMetaKeysRaw = Field{

		Name: "event_meta_keys",
		// contains filtered or unexported fields
	}

	// FieldEventMetaValues is a query result column.
	FieldEventMetaValues = Field{

		Name: "meta_value",
		// contains filtered or unexported fields
	}

	// FieldEventMetaValuesRaw is a query result column.
	FieldEventMetaValuesRaw = Field{

		Name: "event_meta_values",
		// contains filtered or unexported fields
	}

	// FieldEventTimeSpent is a query result column.
	FieldEventTimeSpent = Field{

		Name: "average_time_spent_seconds",
		// contains filtered or unexported fields
	}

	// FieldEventMetaCustomMetricAvg is a query result column.
	FieldEventMetaCustomMetricAvg = Field{

		Name: "custom_metric_avg",
		// contains filtered or unexported fields
	}

	// FieldEventMetaCustomMetricTotal is a query result column.
	FieldEventMetaCustomMetricTotal = Field{

		Name: "custom_metric_total",
		// contains filtered or unexported fields
	}

	// FieldPlatformDesktop is a query result column.
	FieldPlatformDesktop = Field{

		Name: "platform_desktop",
		// contains filtered or unexported fields
	}

	// FieldPlatformMobile is a query result column.
	FieldPlatformMobile = Field{

		Name: "platform_mobile",
		// contains filtered or unexported fields
	}

	// FieldPlatformUnknown is a query result column.
	FieldPlatformUnknown = Field{

		Name: "platform_unknown",
		// contains filtered or unexported fields
	}

	// FieldRelativePlatformDesktop is a query result column.
	FieldRelativePlatformDesktop = Field{

		Name: "relative_platform_desktop",
		// contains filtered or unexported fields
	}

	// FieldRelativePlatformMobile is a query result column.
	FieldRelativePlatformMobile = Field{

		Name: "relative_platform_mobile",
		// contains filtered or unexported fields
	}

	// FieldRelativePlatformUnknown is a query result column.
	FieldRelativePlatformUnknown = Field{

		Name: "relative_platform_unknown",
		// contains filtered or unexported fields
	}

	// FieldEventDurationSeconds is a query result column.
	FieldEventDurationSeconds = Field{

		Name: "duration_seconds",
		// contains filtered or unexported fields
	}
)
View Source
var (
	// ErrNoPeriodOrDay is returned in case no period or day was specified to calculate the growth rate.
	ErrNoPeriodOrDay = errors.New("no period or day specified")
)

Functions

This section is empty.

Types

type Analyzer

type Analyzer struct {
	Visitors     Visitors
	Pages        Pages
	Demographics Demographics
	Device       Device
	UTM          UTM
	Events       Events
	Time         Time
	Tags         Tags
	Sessions     Sessions
	Options      FilterOptions
}

Analyzer provides an interface to analyze statistics.

func NewAnalyzer

func NewAnalyzer(store db.Store) *Analyzer

NewAnalyzer returns a new Analyzer for given Store.

type Demographics

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

Demographics aggregates metadata statistics like the referrer, browser, and OS.

func (*Demographics) Cities

func (demographics *Demographics) Cities(filter *Filter) ([]model.CityStats, error)

Cities returns the visitor count grouped by city.

func (*Demographics) Countries

func (demographics *Demographics) Countries(filter *Filter) ([]model.CountryStats, error)

Countries returns the visitor count grouped by country.

func (*Demographics) Languages

func (demographics *Demographics) Languages(filter *Filter) ([]model.LanguageStats, error)

Languages returns the visitor count grouped by language.

type Device

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

Device aggregates device statistics.

func (*Device) Browser

func (device *Device) Browser(filter *Filter) ([]model.BrowserStats, error)

Browser returns the visitor count grouped by browser.

func (*Device) BrowserVersion

func (device *Device) BrowserVersion(filter *Filter) ([]model.BrowserVersionStats, error)

BrowserVersion returns the visitor count grouped by browser and version.

func (*Device) OS

func (device *Device) OS(filter *Filter) ([]model.OSStats, error)

OS returns the visitor count grouped by operating system.

func (*Device) OSVersion

func (device *Device) OSVersion(filter *Filter) ([]model.OSVersionStats, error)

OSVersion returns the visitor count grouped by operating systems and version.

func (*Device) Platform

func (device *Device) Platform(filter *Filter) (*model.PlatformStats, error)

Platform returns the visitor count grouped by platform.

func (*Device) ScreenClass

func (device *Device) ScreenClass(filter *Filter) ([]model.ScreenClassStats, error)

ScreenClass returns the visitor count grouped by screen class.

type Events

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

Events aggregates statistics regarding events.

func (*Events) Breakdown

func (events *Events) Breakdown(filter *Filter) ([]model.EventStats, error)

Breakdown returns the visitor count, views, and conversion rate for a custom event grouping them by a meta value for given key. The Filter.EventName and Filter.EventMetaKey must be set, or otherwise the result set will be empty.

func (*Events) Events

func (events *Events) Events(filter *Filter) ([]model.EventStats, error)

Events returns the visitor count, views, and conversion rate for custom events.

func (*Events) List

func (events *Events) List(filter *Filter) ([]model.EventListStats, error)

List returns events as a list. The metadata is grouped as key-value pairs.

type Field

type Field struct {
	Name string
	// contains filtered or unexported fields
}

Field is a column for a query.

type Filter

type Filter struct {
	// Ctx can be used to set a timeout or to cancel queries.
	Ctx context.Context

	// ClientID is the optional.
	ClientID int64

	// Timezone sets the timezone used to interpret dates and times.
	// It will be set to UTC by default.
	Timezone *time.Location

	// From is the start date of the selected period.
	From time.Time

	// To is the end date of the selected period.
	To time.Time

	// Period sets the period to group results.
	Period pkg.Period

	// Path filters for the path.
	// Note that if this and PathPattern are both set, Path will be preferred.
	Path []string

	// AnyPath filters for any path in the list.
	AnyPath []string

	// EntryPath filters for the entry page.
	EntryPath []string

	// ExitPath filters for the exit page.
	ExitPath []string

	// PathPattern filters for the path using a (ClickHouse supported) regex pattern.
	// Note that if this and Path are both set, Path will be preferred.
	// Examples for useful patterns (all case-insensitive, * is used for every character but slashes, ** is used for all characters including slashes):
	//  (?i)^/path/[^/]+$ // matches /path/*
	//  (?i)^/path/[^/]+/.* // matches /path/*/**
	//  (?i)^/path/[^/]+/slashes$ // matches /path/*/slashes
	//  (?i)^/path/.+/slashes$ // matches /path/**/slashes
	PathPattern []string

	// Language filters for the ISO language code.
	Language []string

	// Country filters for the ISO country code.
	Country []string

	// City filters for the city name.
	City []string

	// Referrer filters for the full referrer.
	Referrer []string

	// ReferrerName filters for the referrer name.
	ReferrerName []string

	// OS filters for the operating system.
	OS []string

	// OSVersion filters for the operating system version.
	OSVersion []string

	// Browser filters for the browser.
	Browser []string

	// BrowserVersion filters for the browser version.
	BrowserVersion []string

	// Platform filters for the platform (desktop, mobile, unknown).
	Platform string

	// ScreenClass filters for the screen class.
	ScreenClass []string

	// UTMSource filters for the utm_source query parameter.
	UTMSource []string

	// UTMMedium filters for the utm_medium query parameter.
	UTMMedium []string

	// UTMCampaign filters for the utm_campaign query parameter.
	UTMCampaign []string

	// UTMContent filters for the utm_content query parameter.
	UTMContent []string

	// UTMTerm filters for the utm_term query parameter.
	UTMTerm []string

	// Tags filters for tag key-value pairs.
	Tags map[string]string

	// Tag filters for tags by their keys.
	Tag []string

	// EventName filters for events by their name.
	EventName []string

	// EventMetaKey filters for an event meta key.
	// This must be used together with an EventName.
	EventMetaKey []string

	// EventMeta filters for event metadata.
	EventMeta map[string]string

	// VisitorID filters for a visitor.
	// Must be used together with SessionID.
	VisitorID uint64

	// SessionID filters for a session.
	// Must be used together with VisitorID.
	SessionID uint32

	// Search searches the results for given fields and inputs.
	Search []Search

	// Sort sorts the results.
	// This will overwrite the default order provided by the Analyzer.
	Sort []Sort

	// Offset limits the number of results. Less or equal to zero means no offset.
	Offset int

	// Limit limits the number of results. Less or equal to zero means no limit.
	Limit int

	// CustomMetricKey is used to calculate the average and total for an event metadata field.
	// This must be used together with EventName and CustomMetricType.
	CustomMetricKey string

	// CustomMetricType is used to calculate the average and total for an event metadata field.
	CustomMetricType pkg.CustomMetricType

	// IncludeTime sets whether the selected period should contain the time (hour, minute, second).
	IncludeTime bool

	// IncludeTitle indicates that the Analyzer.ByPath, Analyzer.Entry, and Analyzer.Exit should contain the page title.
	IncludeTitle bool

	// IncludeTimeOnPage indicates that the Analyzer.ByPath and Analyzer.Entry should contain the average time on page.
	IncludeTimeOnPage bool

	// IncludeCR indicates that Analyzer.Total and Analyzer.ByPeriod should contain the conversion rate.
	IncludeCR bool

	// MaxTimeOnPageSeconds is an optional maximum for the time spent on page.
	// Visitors who are idle artificially increase the average time spent on a page, this option can be used to limit the effect.
	// Set to 0 to disable this option (default).
	MaxTimeOnPageSeconds int

	// Sample sets the (optional) sampling size.
	Sample uint
}

Filter are all fields that can be used to filter the result sets. Fields can be inverted by adding a "!" in front of the string. To compare to none/unknown/empty, set the value to "null" (case-insensitive).

func NewFilter

func NewFilter(clientID int64) *Filter

NewFilter creates a new filter for given client ID.

type FilterOptions

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

FilterOptions returns options that can be used to filter results. This includes distinct pages, referrers, ... for a given period. Common options, like the operating system or browser, are not read from the database.

func (*FilterOptions) Cities

func (options *FilterOptions) Cities(filter *Filter) ([]string, error)

Cities returns all cities.

func (*FilterOptions) Countries

func (options *FilterOptions) Countries(filter *Filter) ([]string, error)

Countries returns all countries.

func (*FilterOptions) EventMetadataValues

func (options *FilterOptions) EventMetadataValues(filter *Filter) ([]string, error)

EventMetadataValues returns all metadata values.

func (*FilterOptions) Events

func (options *FilterOptions) Events(filter *Filter) ([]string, error)

Events returns all event names.

func (*FilterOptions) Languages

func (options *FilterOptions) Languages(filter *Filter) ([]string, error)

Languages returns all languages.

func (*FilterOptions) Pages

func (options *FilterOptions) Pages(filter *Filter) ([]string, error)

Pages returns all paths. This can also be used for the entry and exit pages.

func (*FilterOptions) Referrer

func (options *FilterOptions) Referrer(filter *Filter) ([]string, error)

Referrer returns all referrers.

func (*FilterOptions) ReferrerName

func (options *FilterOptions) ReferrerName(filter *Filter) ([]string, error)

ReferrerName returns all referrer names.

func (*FilterOptions) TagKeys added in v6.7.0

func (options *FilterOptions) TagKeys(filter *Filter) ([]string, error)

TagKeys returns all tag keys.

func (*FilterOptions) TagValues added in v6.7.0

func (options *FilterOptions) TagValues(filter *Filter) ([]string, error)

TagValues returns all tag values. The Filter.Tag must be set to exactly one tag, or otherwise the result set will be empty.

func (*FilterOptions) UTMCampaign

func (options *FilterOptions) UTMCampaign(filter *Filter) ([]string, error)

UTMCampaign returns all UTM campaigns.

func (*FilterOptions) UTMContent

func (options *FilterOptions) UTMContent(filter *Filter) ([]string, error)

UTMContent returns all UTM contents.

func (*FilterOptions) UTMMedium

func (options *FilterOptions) UTMMedium(filter *Filter) ([]string, error)

UTMMedium returns all UTM media.

func (*FilterOptions) UTMSource

func (options *FilterOptions) UTMSource(filter *Filter) ([]string, error)

UTMSource returns all UTM sources.

func (*FilterOptions) UTMTerm

func (options *FilterOptions) UTMTerm(filter *Filter) ([]string, error)

UTMTerm returns all UTM terms.

type Pages

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

Pages aggregates statistics regarding pages.

func (*Pages) ByEventPath

func (pages *Pages) ByEventPath(filter *Filter) ([]model.PageStats, error)

ByEventPath returns the visitor count, session count, bounce rate, views, and average time on page grouped by event path and (optional) title.

func (*Pages) ByPath

func (pages *Pages) ByPath(filter *Filter) ([]model.PageStats, error)

ByPath returns the visitor count, session count, bounce rate, views, and average time on page grouped by path and (optional) page title.

func (*Pages) Conversions

func (pages *Pages) Conversions(filter *Filter) (*model.ConversionsStats, error)

Conversions returns the visitor count, views, conversion rate, and custom metric for conversion goals.

func (*Pages) Entry

func (pages *Pages) Entry(filter *Filter) ([]model.EntryStats, error)

Entry returns the visitor count and time on page grouped by path and (optional) page title for the first page visited.

func (*Pages) Exit

func (pages *Pages) Exit(filter *Filter) ([]model.ExitStats, error)

Exit returns the visitor count and time on page grouped by path and (optional) page title for the last page visited.

type Search struct {
	Field Field
	Input string
}

Search filters results by searching for the given input for given field. The field needs to contain the search string and is performed case-insensitively.

type Sessions added in v6.8.0

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

Sessions aggregates statistics regarding single sessions.

func (*Sessions) Breakdown added in v6.8.0

func (sessions *Sessions) Breakdown(filter *Filter) ([]model.SessionStep, error)

Breakdown returns the page views and events for a single session in chronological order.

func (*Sessions) List added in v6.8.0

func (sessions *Sessions) List(filter *Filter) ([]model.Session, error)

List returns a list of sessions for given filter.

type Sort

type Sort struct {
	Field     Field
	Direction pkg.Direction
}

Sort sorts results by a field and direction.

type Tags added in v6.7.0

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

Tags aggregates statistics regarding tags.

func (*Tags) Breakdown added in v6.7.0

func (events *Tags) Breakdown(filter *Filter) ([]model.TagStats, error)

Breakdown returns the visitor count for tags grouping them by given key. The Filter.Tag must be set, or otherwise the result set will be empty.

func (*Tags) Keys added in v6.7.0

func (events *Tags) Keys(filter *Filter) ([]model.TagStats, error)

Keys returns the visitor count grouped by tag keys.

type Time

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

Time aggregates statistics regarding the time on page and session duration.

func (*Time) AvgSessionDuration

func (t *Time) AvgSessionDuration(filter *Filter) ([]model.TimeSpentStats, error)

AvgSessionDuration returns the average session duration grouped by day, week, month, or year.

func (*Time) AvgTimeOnPage

func (t *Time) AvgTimeOnPage(filter *Filter) ([]model.TimeSpentStats, error)

AvgTimeOnPage returns the average time on page grouped by day, week, month, or year.

type UTM

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

UTM aggregates UTM campaign statistics.

func (*UTM) Campaign

func (utm *UTM) Campaign(filter *Filter) ([]model.UTMCampaignStats, error)

Campaign returns the visitor count grouped by utm source.

func (*UTM) Content

func (utm *UTM) Content(filter *Filter) ([]model.UTMContentStats, error)

Content returns the visitor count grouped by utm source.

func (*UTM) Medium

func (utm *UTM) Medium(filter *Filter) ([]model.UTMMediumStats, error)

Medium returns the visitor count grouped by utm medium.

func (*UTM) Source

func (utm *UTM) Source(filter *Filter) ([]model.UTMSourceStats, error)

Source returns the visitor count grouped by utm source.

func (*UTM) Term

func (utm *UTM) Term(filter *Filter) ([]model.UTMTermStats, error)

Term returns the visitor count grouped by utm source.

type Visitors

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

Visitors aggregates statistics regarding visitors.

func (*Visitors) Active

func (visitors *Visitors) Active(filter *Filter, duration time.Duration) ([]model.ActiveVisitorStats, int, error)

Active returns the active visitors per path and (optional) page title and the total number of active visitors for given duration. Use time.Minute*5 for example to get the active visitors for the past 5 minutes.

func (*Visitors) ByHour

func (visitors *Visitors) ByHour(filter *Filter) ([]model.VisitorHourStats, error)

ByHour returns the visitor count grouped by time of day.

func (*Visitors) ByMinute added in v6.8.0

func (visitors *Visitors) ByMinute(filter *Filter) ([]model.VisitorMinuteStats, error)

ByMinute returns the visitor count grouped by the minute of the hour.

func (*Visitors) ByPeriod

func (visitors *Visitors) ByPeriod(filter *Filter) ([]model.VisitorStats, error)

ByPeriod returns the visitor count, session count, bounce rate, views, CR, and average and total custom metric grouped by day, week, month, or year.

func (*Visitors) Growth

func (visitors *Visitors) Growth(filter *Filter) (*model.Growth, error)

Growth returns the growth rate for visitor count, session count, bounces, views, and average session duration or average time on page (if path is set). The growth rate is relative to the previous time range or day. The period or day for the filter must be set, else an error is returned.

func (*Visitors) Referrer

func (visitors *Visitors) Referrer(filter *Filter) ([]model.ReferrerStats, error)

Referrer returns the visitor count and bounce rate grouped by referrer.

func (*Visitors) Total

func (visitors *Visitors) Total(filter *Filter) (*model.TotalVisitorStats, error)

Total returns the total visitor count, session count, bounce rate, views, CR, and average and total custom metric.

func (*Visitors) TotalPageViews added in v6.4.0

func (visitors *Visitors) TotalPageViews(filter *Filter) (int, error)

TotalPageViews returns the total number of page views.

func (*Visitors) TotalSessions added in v6.4.0

func (visitors *Visitors) TotalSessions(filter *Filter) (int, error)

TotalSessions returns the total number of sessions.

func (*Visitors) TotalVisitors added in v6.2.0

func (visitors *Visitors) TotalVisitors(filter *Filter) (int, error)

TotalVisitors returns the total unique visitor count.

func (*Visitors) TotalVisitorsPageViews

func (visitors *Visitors) TotalVisitorsPageViews(filter *Filter) (*model.TotalVisitorsPageViewsStats, error)

TotalVisitorsPageViews returns the total visitor count and number of page views including the growth.

Jump to

Keyboard shortcuts

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