Documentation ¶
Index ¶
- type BuffConsumer
- type Consumer
- type Event
- type Mixpanel
- func (mp *Mixpanel) Alias(alias_id, original_id string) error
- func (mp *Mixpanel) PeopleAppend(id string, properties *P) error
- func (mp *Mixpanel) PeopleDelete(id string) error
- func (mp *Mixpanel) PeopleIncrement(id string, properties *P) error
- func (mp *Mixpanel) PeopleSet(id string, properties *P) error
- func (mp *Mixpanel) PeopleSetOnce(id string, properties *P) error
- func (mp *Mixpanel) PeopleTrackCharge(id string, amount float64, prop *P) error
- func (mp *Mixpanel) PeopleUnion(id string, properties *P) error
- func (mp *Mixpanel) PeopleUnset(id string, properties []string) error
- func (mp *Mixpanel) PeopleUpdate(properties *P) error
- func (mp *Mixpanel) Track(distinct_id, event string, prop *P) error
- type P
- type StdConsumer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuffConsumer ¶
type BuffConsumer struct { StdConsumer // contains filtered or unexported fields }
func NewBuffConsumer ¶
func NewBuffConsumer(maxSize int64) *BuffConsumer
func (*BuffConsumer) Flush ¶
func (bc *BuffConsumer) Flush() error
Flush Send all remaining messages to Mixpanel. BufferedConsumers will flush automatically when you call Send(), but you will need to call Flush() when you are completely done using the consumer (for example, when your application exits) to ensure there are no messages remaining in memory.
type Mixpanel ¶
type Mixpanel struct { Token string `json:token` // contains filtered or unexported fields }
func NewMixpanel ¶
NewMixpanel Creates a new Mixpanel object, which can be used for all tracking.
To use mixpanel, create a new Mixpanel object using your token. Takes in a user token and uses a StdConsumer
func NewMixpanelWithConsumer ¶
NewMixpanelWithConsumer Creates a new Mixpanel object, which can be used for all tracking.
To use mixpanel, create a new Mixpanel object using your token. Takes in a user token and an optional Consumer (or anything else with a send() method). If no consumer is provided, Mixpanel will use the default Consumer, which communicates one synchronous request for every message.
func (*Mixpanel) Alias ¶
Alias gives custom alias to a people record.
Alias sends an update to our servers linking an existing distinct_id with a new id, so that events and profile updates associated with the new id will be associated with the existing user's profile and behavior. Example:
mp.Alias("amy@mixpanel.com", "13793")
func (*Mixpanel) PeopleAppend ¶
PeopleAppend appends to the list associated with a property.
Takes a JSON object containing keys and values, and appends each to a list associated with the corresponding property name. $appending to a property that doesn't exist will result in assigning a list with one element to that property. Example:
mp.PeopleAppend("12345", &P{ "Power Ups": "Bubble Lead" })
func (*Mixpanel) PeopleDelete ¶
PeopleDelete permanently deletes a profile.
Permanently delete the profile from Mixpanel, along with all of its properties. Example:
mp.PeopleDelete("12345")
func (*Mixpanel) PeopleIncrement ¶
PeopleIncrement Increments/decrements numerical properties of people record.
Takes in JSON object with keys and numerical values. Adds numerical values to current property of profile. If property doesn't exist adds value to zero. Takes in negative values for subtraction. Example:
mp.PeopleIncrement("12345", &P{"Coins Gathered": 12})
func (*Mixpanel) PeopleSet ¶
PeopleSet set properties of a people record.
PeopleSet sets properties of a people record given in JSON object. If the profile does not exist, creates new profile with these properties. Example:
mp.PeopleSet("12345", &P{"Address": "1313 Mockingbird Lane", "Birthday": "1948-01-01"})
func (*Mixpanel) PeopleSetOnce ¶
PeopleSetOnce sets immutable properties of a people record.
PeopleSetOnce sets properties of a people record given in JSON object. If the profile does not exist, creates new profile with these properties. Does not overwrite existing property values. Example:
mp.PeopleSetOnce("12345", &P{"First Login": "2013-04-01T13:20:00"})
func (*Mixpanel) PeopleTrackCharge ¶
PeopleTrackCharge Tracks a charge to a user.
Record that you have charged the current user a certain amount of money. Charges recorded with track_charge will appear in the Mixpanel revenue report. Example:
//tracks a charge of $50 to user '1234' mp.PeopleTrackCharge("1234", 50, nil) //tracks a charge of $50 to user '1234' at a specific time mp.PeopleTrackCharge("1234", 50, {"$time": "2013-04-01T09:02:00"})
func (*Mixpanel) PeopleUnion ¶
PeopleUnion Merges the values for a list associated with a property.
Takes a JSON object containing keys and list values. The list values in the request are merged with the existing list on the user profile, ignoring duplicate list values. Example:
mp.PeopleUnion("12345", &P{ "Items purchased": ["socks", "shirts"] } )
func (*Mixpanel) PeopleUnset ¶
PeopleUnset removes properties from a profile.
Takes a JSON list of string property names, and permanently removes the properties and their values from a profile. Example:
mp.PeopleUnset("12345", ["Days Overdue"])
func (*Mixpanel) PeopleUpdate ¶
PeopleUpdate sends a generic update to Mixpanel people analytics. Caller is responsible for formatting the update message, as documented in the Mixpanel HTTP specification, and passing the message as a dict to update. This method might be useful if you want to use very new or experimental features of people analytics from python The Mixpanel HTTP tracking API is documented at https://mixpanel.com/help/reference/http
func (*Mixpanel) Track ¶
Notes that an event has occurred, along with a distinct_id representing the source of that event (for example, a user id), an event name describing the event and a set of properties describing that event. Properties are provided as a Hash with string keys and strings, numbers or booleans as values.
// Track that user "12345"'s credit card was declined mp.Track("12345", "Credit Card Declined", nil)
// Properties describe the circumstances of the event, // or aspects of the source or user associated with the event
mp.Track("12345", "Welcome Email Sent", &P{ "Email Template" : "Pretty Pink Welcome", "User Sign-up Cohort" : "July 2013", })
type StdConsumer ¶
type StdConsumer struct {
// contains filtered or unexported fields
}
func NewStdConsumer ¶
func NewStdConsumer() *StdConsumer
Creates a new StdConsumer. Sends one message at a time