analytics

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package analytics provides functionality for interacting with the Google Analytics API.

Index

Constants

View Source
const Cookie = "_gap"

Cookie is a client cookie that is used to pseudonymously identify a particular user across multiple requests.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

View Source
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.

func (*Tracker) ServeHTTP

func (t *Tracker) ServeHTTP(writer http.ResponseWriter, request *http.Request)

Jump to

Keyboard shortcuts

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