Documentation
¶
Overview ¶
Package analytics provides tools for sending over Wash events and screenviews to Google Analytics
Index ¶
Constants ¶
const FlushDuration = 250 * time.Millisecond
FlushDuration represents the amount of time of a typical Client#Flush operation. Users of the analytics package should use this value when they need to flush outstanding analytics hits prior to exiting their application.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { Screenview(name string, params Params) error Event(category string, action string, params Params) error Flush() }
Client represents a Google Analytics client. Hits are submitted to GA in batches of 20 to avoid overloading the network.
Screenview queues a screenview hit, while Event queues an event hit. Params represents additional measurement protocol parameters to pass into Client#Screenview or Client#Event. These will typically be custom dimension values. The currently supported custom dimensions are "Plugin" and "Entry Type". Note that Event hits can also specify the event's (optional) label and value via the "Label" and "Value" keys in params.
NOTE: See https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters for more details about the measurement protocol.
NOTE: Screenview and Event will only return an error for invalid input. If you always expect valid input, then feel free to ignore the error or to panic on it.