analytics

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(b Backend)

Add adds the given backend to the backends used to send analytics.

func GoogleAnalyticsHeader

func GoogleAnalyticsHeader(propertyID string) string

GoogleAnalyticsHeader returns the header to use in the app.Handler.RawHeader field to initialize Google Analytics.

func Identify

func Identify(userID string, traits map[string]interface{})

Identify links your users, and their actions, to a recognizable userID and traits.

func Page

func Page(name string, properties map[string]interface{})

Page records page views on your website, along with optional extra information about the page viewed by the user.

The following properties are automatically set: path, referrer, search, title and url.

func Track

func Track(event string, properties map[string]interface{})

Track record actions your users perform.

Types

type Backend

type Backend interface {
	// Links your users, and their actions, to a recognizable userID and traits.
	Identify(userID string, traits map[string]interface{})

	// Record actions your users perform.
	Track(event string, properties map[string]interface{})

	// Records page views on your website, along with optional extra information
	// about the page viewed by the user.
	Page(name string, properties map[string]interface{})
}

Backend is the interface that describes an analytics backend that sends analytics for a defined provider.

func NewGoogleAnalytics

func NewGoogleAnalytics() Backend

Jump to

Keyboard shortcuts

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