analytics

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// PageViewHitType measure page views
	PageViewHitType = "pageview"
	// ScreenViewHitType measure sceen views in apps
	ScreenViewHitType = "screenview"
	// EventHitType measure any kind of event
	EventHitType = "event"
	// TransactionHitType measure e-commerce transactions
	TransactionHitType = "transaction"
	// ItemHitType measure items related to e-commerce transactions
	ItemHitType = "item"
	// SocialHitType measure activities on social media
	SocialHitType = "social"
)

Variables

This section is empty.

Functions

func AddReporter

func AddReporter(r ReportFunc)

AddReporter appends a ReportFunc to the array of uploaders that are called in turn

func LogReporter

func LogReporter(e *Event)

LogReporter is the most basic reporter func

func TrackEvent

func TrackEvent(request *http.Request, client, category, action, label string, value int)

TrackEvent post an event to analytics

func TrackPageView

func TrackPageView(request *http.Request, client string)

TrackPageView posts a pageview event to analytics

Types

type ClientRequest

type ClientRequest struct {
	IP          string
	Host        string
	Request     string
	UserID      string
	Fingerprint string
	UserAgent   string
}

ClientRequest identifies a user, client request etc

func CreateClientRequest

func CreateClientRequest(request *http.Request) *ClientRequest

CreateClientRequest returns a ClientRequest struct

type Event

type Event struct {
	Type      string // hit type
	Timestamp int64  // timestamp the event was created
	Client    *ClientRequest
	Values    map[string]string // k/v pairs of event data
}

Event contains, well, events

type ReportFunc

type ReportFunc func(*Event)

ReportFunc is the func interface used implement various 'uploaders'

Jump to

Keyboard shortcuts

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