Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Types = newEventTypes()
Types of events
Functions ¶
This section is empty.
Types ¶
type BaseEvent ¶
type BaseEvent struct {
TrackingID string `json:"tid"`
ClientIP string `json:"-"`
CountryCode string `json:"country,omitempty"`
UserAgent string `json:"-"`
Browser string `json:"browser"`
OS string `json:"os"`
Tags map[string]string `json:"tags"`
Timestamp time.Time `json:"timestamp"`
}
BaseEvent contains common events fields
func NewBaseEvent ¶ added in v1.1.1
NewBaseEvent create new base event
func (*BaseEvent) FormattedTS ¶ added in v1.1.1
FormattedTS returns formatted timestamp
type Event ¶
type Event interface {
// Type returns event type
Type() string
// TS returns event timestamp
TS() time.Time
// FormattedTS returns event formated timestamp
FormattedTS() string
// Labels return event labels
Labels() Labels
// ToMap convert event to map structure
ToMap() map[string]interface{}
}
Event is the generic interface for a tracking event
type Exception ¶
type Exception struct {
BaseEvent
Message string `json:"msg"`
Line int `json:"line"`
Column int `json:"column"`
URL string `json:"url"`
Error string `json:"error"`
}
Exception contains tracked attribute when an error is triggered
func NewExceptionEvent ¶
NewExceptionEvent create exception event from HTTP request
func (*Exception) FormattedTS ¶
FormattedTS returns formatted timestamp
type PageView ¶
type PageView struct {
BaseEvent
Protocol string `json:"-"`
UserLanguage string `json:"language"`
DocumentHostName string `json:"hostname"`
DocumentPath string `json:"path"`
DocumentReferer string `json:"referer"`
IsNewVisitor bool `json:"new_visitor"`
IsNewSession bool `json:"new_session"`
TimeOnPage int `json:"top"`
}
PageView contains tracked attribute when a page is viewed
func NewPageViewEvent ¶
NewPageViewEvent create page view event from HTTP request
func (*PageView) FormattedTS ¶
FormattedTS returns formatted timestamp
type PingEvent ¶ added in v1.5.0
type PingEvent struct {
SimpleEvent
From string
To string
}
PingEvent contains tracked attribute for a ping event
func NewPingEvent ¶ added in v1.5.0
NewPingEvent create ping event from HTTP request
type SimpleEvent ¶
SimpleEvent contains tracked attribute for a simple event
func NewSimpleEvent ¶
func NewSimpleEvent(base *BaseEvent, r *http.Request) (*SimpleEvent, error)
NewSimpleEvent create simple event from HTTP request
func (*SimpleEvent) FormattedTS ¶
func (se *SimpleEvent) FormattedTS() string
FormattedTS returns formatted timestamp
func (*SimpleEvent) ToMap ¶ added in v1.4.0
func (se *SimpleEvent) ToMap() map[string]interface{}
ToMap convert event to map structure