-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
example_test.go
49 lines (40 loc) · 939 Bytes
/
example_test.go
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
43
44
45
46
47
48
49
package mixpanel
import "time"
func ExampleNew() {
New("mytoken", "")
}
func ExampleNewWithSecret() {
NewWithSecret("mytoken", "myapisecret", "")
}
func ExampleMixpanel() {
client := New("mytoken", "")
client.Track("1", "Sign Up", &Event{
Properties: map[string]interface{}{
"from": "email",
},
})
}
func ExamplePeople() {
client := NewWithSecret("mytoken", "myapisecret", "")
client.UpdateUser("1", &Update{
Operation: "$set",
Properties: map[string]interface{}{
"$email": "[email protected]",
"$last_login": time.Now(),
"$created": time.Now().String(),
"custom_field": "cool!",
},
})
client.Track("1", "Sign Up", &Event{
Properties: map[string]interface{}{
"from": "email",
},
})
importTimestamp := time.Now().Add(-5 * 24 * time.Hour)
client.Import("1", "Sign Up", &Event{
Timestamp: &importTimestamp,
Properties: map[string]interface{}{
"subject": "topic",
},
})
}