Skip to content

jobrapp/mixpanel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mixpanel

Go (Go-lang) Mixpanel lib

usage

event := tracking.UserEvent{
  DistinctId: DISTINCT_ID,
  Name: EVENT_NAME,
  
}
tracking.Client{MIXPANEL_TOKEN}.Track(userId, event_name, propsMap, [queryParams])
mixpanel.New(token).Engage(userId, propsMap, ip)

Basic Usage

import (
  "mixpanel"
  "os"
)
.
.
.
// event properties 
var propsMap map[string]interface{}{
	"purchaseAmt": 9,
	"productName": "Shoe"
}

// optional query parameters
qparams := map[string]interface{}{
	"img":      1,
	"ip":       1,
	"callback": "someFuncName",
	"redirect": "https://www.google.com/someUrl?p=true",
}
// Send data to Mixpanel
mixpanel.New(os.Getenv("MIXPANEL_TOKEN")).Track(1, "purchased", propsMap, qparams)

if you specify query parameters without events properties, pass nil for propsMap.

TODO:

  • abstract params into helper
  • apply params() function in engage
  • batch events/engage

About

golang mixpanel lib

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages