Documentation ¶
Index ¶
- Variables
- func Disable()
- func Enable(ctx context.Context, clientID string, version AppVersion)
- func Flush()
- func Send(p Payload)
- func SendBug(id int, extras ...Payload)
- func SendEvent(category, action, label string, extras ...Payload)
- func SendException(description string, fatal bool, extras ...Payload)
- type AppVersion
- type Count
- type ErrPayloadTooLarge
- type Event
- type Exception
- type Payload
- type SessionEnd
- type SessionStart
- type Size
- type Stop
- type Timing
Constants ¶
This section is empty.
Variables ¶
var OnError = func(err error) {}
OnError is called whenever there was a problem sending analytics. By default errors are simply ignored.
Functions ¶
func Enable ¶
func Enable(ctx context.Context, clientID string, version AppVersion)
Enable turns on Google Analytics tracking functionality using the given clientID and version.
func Flush ¶
func Flush()
Flush flushes any pending Payloads to be sent to the Google Analytics server.
func Send ¶
func Send(p Payload)
Send queues the Payload p to be sent to the Google Analytics server if analytics is enabled with a prior call to Enable().
func SendException ¶
SendException sends the exception to the Google Analytics server (if enabled).
Types ¶
type AppVersion ¶
AppVersion holds information about the currently running application and its version.
type Count ¶
type Count int
Count is a payload value for count values, usually number of items. Examples: Number of commands in a capture.
type ErrPayloadTooLarge ¶
ErrPayloadTooLarge is the error returned when attempting to send a payload that is too large to send.
func (ErrPayloadTooLarge) Error ¶
func (e ErrPayloadTooLarge) Error() string
type Payload ¶
type Payload interface{}
Payload is the interface implemented by Google Analytic payload types.
func TargetDevice ¶
func TargetDevice(interface{}) Payload
TargetDevice returns a payload value that describes a target device.
type SessionEnd ¶
type SessionEnd struct{}
SessionEnd is a payload value to indicate the end of a session.
type SessionStart ¶
type SessionStart struct{}
SessionStart is a payload value to indicate the start of a session.
type Size ¶
type Size int
Size is a payload value for size values, usually representing bytes. Examples: File size.
type Stop ¶
type Stop func(extras ...Payload)
Stop is the function returned by SendTiming to end the timed region and send the result to the Google Analytics server (if enabled).
func SendTiming ¶
SendTiming is a no-op when analytics are not enabled.