Documentation
¶
Index ¶
- Constants
- func AddSender(sender Sender)
- func QueueMessage(ctx context.Context, msg Message)
- type ErrorMessage
- type Event
- type Message
- type Pageview
- type Product
- type Properties
- func (p Properties) Set(name string, value interface{}) Properties
- func (p Properties) SetCategory(category string) Properties
- func (p Properties) SetCoupon(coupon string) Properties
- func (p Properties) SetCurrency(currency string) Properties
- func (p Properties) SetDiscount(discount float64) Properties
- func (p Properties) SetName(name string) Properties
- func (p Properties) SetOrderId(id string) Properties
- func (p Properties) SetPath(path string) Properties
- func (p Properties) SetPrice(price float64) Properties
- func (p Properties) SetProductId(id string) Properties
- func (p Properties) SetProducts(products ...Product) Properties
- func (p Properties) SetReferrer(referrer string) Properties
- func (p Properties) SetRepeat(repeat bool) Properties
- func (p Properties) SetRevenue(revenue float64) Properties
- func (p Properties) SetSKU(sku string) Properties
- func (p Properties) SetShipping(shipping float64) Properties
- func (p Properties) SetSubtotal(subtotal float64) Properties
- func (p Properties) SetTax(tax float64) Properties
- func (p Properties) SetTitle(title string) Properties
- func (p Properties) SetTotal(total float64) Properties
- func (p Properties) SetURL(url string) Properties
- func (p Properties) SetValue(value float64) Properties
- type Sender
- type Timing
- type UserContext
Constants ¶
View Source
const ErrorEvent = "error"
Variables ¶
This section is empty.
Functions ¶
func QueueMessage ¶
Types ¶
type ErrorMessage ¶ added in v0.0.4
func NewErrorMessage ¶ added in v0.0.4
func NewErrorMessage(err error) ErrorMessage
type Event ¶
type Message ¶
type Message interface {
Event() string
User() UserContext
SetUserContext(user UserContext)
Properties() Properties
Validate() error
GetApiClientID() string
// Category retrieves the category of the message.
Category() string
// SetCategory sets the category value for the message.
SetCategory(category string)
}
type Pageview ¶
type Pageview interface {
Message
Host() string
Path() string
Title() string
SetTitle(title string) Pageview
URL() string
SetURL(url string) Pageview
SetUserAgent(userAgent string) Pageview
}
func NewPageview ¶
type Product ¶
type Product struct {
ID string `json:"id,omitempty"`
SKU string `json:"sky,omitempty"`
Name string `json:"name,omitempty"`
Price float64 `json:"price"`
}
Product represents products in the E-commerce API.
type Properties ¶
Properties are used to represent properties in messages that support it. It is a free-form object, so the application can set any value it sees fit, but a few helper methods are defined to make it easier to instantiate properties with common fields. Here's a quick example of how this type is meant to be used:
analytics.page{
UserId: "0123456789",
Properties: analytics.NewProperties()
.SetRevenue(10.0)
.SetCurrency("USD"),
}
func NewProperties ¶
func NewProperties() Properties
func (Properties) Set ¶
func (p Properties) Set(name string, value interface{}) Properties
func (Properties) SetCategory ¶
func (p Properties) SetCategory(category string) Properties
func (Properties) SetCoupon ¶
func (p Properties) SetCoupon(coupon string) Properties
func (Properties) SetCurrency ¶
func (p Properties) SetCurrency(currency string) Properties
func (Properties) SetDiscount ¶
func (p Properties) SetDiscount(discount float64) Properties
func (Properties) SetName ¶
func (p Properties) SetName(name string) Properties
func (Properties) SetOrderId ¶
func (p Properties) SetOrderId(id string) Properties
func (Properties) SetPath ¶
func (p Properties) SetPath(path string) Properties
func (Properties) SetPrice ¶
func (p Properties) SetPrice(price float64) Properties
func (Properties) SetProductId ¶
func (p Properties) SetProductId(id string) Properties
func (Properties) SetProducts ¶
func (p Properties) SetProducts(products ...Product) Properties
func (Properties) SetReferrer ¶
func (p Properties) SetReferrer(referrer string) Properties
func (Properties) SetRepeat ¶
func (p Properties) SetRepeat(repeat bool) Properties
func (Properties) SetRevenue ¶
func (p Properties) SetRevenue(revenue float64) Properties
func (Properties) SetSKU ¶
func (p Properties) SetSKU(sku string) Properties
func (Properties) SetShipping ¶
func (p Properties) SetShipping(shipping float64) Properties
func (Properties) SetSubtotal ¶
func (p Properties) SetSubtotal(subtotal float64) Properties
func (Properties) SetTax ¶
func (p Properties) SetTax(tax float64) Properties
func (Properties) SetTitle ¶
func (p Properties) SetTitle(title string) Properties
func (Properties) SetTotal ¶
func (p Properties) SetTotal(total float64) Properties
func (Properties) SetURL ¶
func (p Properties) SetURL(url string) Properties
func (Properties) SetValue ¶
func (p Properties) SetValue(value float64) Properties
type UserContext ¶
type UserContext interface {
GetUserID() string
Validate() error
GetUserLanguage() string
SetUserLanguage(language string) UserContext
GetUserAgent() string
SetUserAgent(userAgent string) UserContext
QueueMessage(ctx context.Context, msg Message)
}
func NewUserContext ¶
func NewUserContext(userID string) UserContext
Click to show internal directories.
Click to hide internal directories.