-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (40 loc) · 1.13 KB
/
main.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
package main
import (
"github.com/brycensranch/go-aptabase/pkg/aptabase/v1"
"log"
)
type Event struct {
EventName string
EventParams map[string]string
}
func main() {
// Initialize the tracking client
apiKey := "A-US-34040404" // Replace with your actual API key
appVersion := "1.0.0"
appBuildNumber := uint64(123)
debugMode := false
// You can change this to your self hosted Aptabase instance
// host := "https://aptabase.brycen.app"
// A empty string uses automatic detection
host := ""
client := aptabase.NewClient(apiKey, appVersion, appBuildNumber, debugMode, host)
event := aptabase.EventData{
EventName: "UserSignUp",
Props: map[string]interface{}{
"username": "johndoe",
"email": "johndoe@example.com",
},
}
client.TrackEvent(event)
event2 := aptabase.EventData{
EventName: "UserSignIn",
Props: map[string]interface{}{
"username": "johndoe",
"email": "johndoe@example.com",
},
}
client.TrackEvent(event2)
// You need to flush all the events at the end of your application otherwise they will not be sent.
client.Stop()
log.Printf("I am done running the example and I've called stop")
}