-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.go
More file actions
42 lines (35 loc) · 792 Bytes
/
Copy pathexample.go
File metadata and controls
42 lines (35 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"fmt"
"mixpanel"
)
func main() {
m := mixpanel.NewMixpanel()
m.SetApiToken("yourApiToken")
//granular api
e := m.NewEvent()
e.SetName("Granular API Event")
e.SetProperties(map[string] interface{} {
"lib": "GoMixpanel",
"author": "Rich Collins"})
e.SetProperty("version", "20121127")
if success, err := e.Send(); success {
fmt.Println("Granular Success")
} else if err == nil {
fmt.Println("Granular Failure")
} else {
fmt.Println(err)
}
//terse api
success, err := m.SendEvent("Terse API Event", map[string] interface{} {
"lib": "GoMixpanel",
"author": "Rich Collins",
"version": "20121127"})
if success {
fmt.Println("Terse Success")
} else if err == nil {
fmt.Println("Terse Failure")
} else {
fmt.Println(err)
}
}