Documentation
¶
Overview ¶
Package analytics provides functionality for interacting with the Google Analytics API.
Index ¶
Constants ¶
const Cookie = "_gap"
Cookie is a client cookie that is used to pseudonymously identify a particular user across multiple requests.
const HeaderTitle = "X-Gap-Title"
HeaderTitle is an HTTP header that can be returned by an upstream server to manually set the "Document Title" value.
const HeaderUTMCampaign = "X-Gap-Utm-Campaign"
HeaderUTMCampaign is an HTTP header that can be returned by an upstream server to manually set the "Campaign Name" value.
const HeaderUTMContent = "X-Gap-Utm-Content"
HeaderUTMContent is an HTTP header that can be returned by an upstream server to manually set the "Campaign Content" value.
const HeaderUTMID = "X-Gap-Utm-ID"
HeaderUTMID is an HTTP header that can be returned by an upstream server to manually set the "Campaign ID" value.
const HeaderUTMMedium = "X-Gap-Utm-Medium"
HeaderUTMMedium is an HTTP header that can be returned by an upstream server to manually set the "Campaign Medium" value.
const HeaderUTMSource = "X-Gap-Utm-Source"
HeaderUTMSource is an HTTP header that can be returned by an upstream server to manually set the "Campaign Source" value.
const HeaderUTMTerm = "X-Gap-Utm-Term"
HeaderUTMTerm is an HTTP header that can be returned by an upstream server to manually set the "Campaign Keyword" value.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tracker ¶
type Tracker struct {
// TrackingID is the tracking id for the Google Analytics property that you
// want to track pageview events for. This value can be found in your
// Google Analytics dashboard.
// Example: "UA-123456789-1"
TrackingID string
// PropertyName is the name for the Google Analytics property that you want
// to track pageview events for. This can be found in your Google Analytics
// dashboard.
// Example: "example.com"
PropertyName string
// DryRun is used to disable reporting pageview events.
DryRun bool
// Handler is a http handler that is "wrapped" by the Tracker and actually
// processes the client requests. The original request, as well as the
// response generated by the handler is used to extract analytics data.
Handler http.Handler
}
Tracker implements a custom http.Handler that wraps another http.Handler. When a request is handled by a Tracker, the wrapped http.Handler will be executed, and information about the request and response will be used to register a pageview event using the Google Analytics API.