This is a quick start guide. For more information about the Inspector project please read Avo Inspector SDK Reference and the Avo Inspector Setup Guide.
go get github.com/avohq/go-avo-inspector
Obtain the API key at Avo.app
import (
avoinspector "github.com/avohq/go-avo-inspector"
)
avoInspector, err := avoinspector.NewAvoInspector(
"...", // Your API key obtained in the Avo workspace
avoinspector.Dev, // or avoinspector.Staging, avoinspector.Prod
"1.0", // App version
"my app", // App name
)
Logs are enabled by default in the dev mode and disabled in prod mode.
avoInspector.ShouldLog(true)
Whenever you send a tracking event, also call the following method:
Read more in the Avo documentation
This method gets actual tracking event parameters, extracts schema automatically and sends it to the Avo Inspector backend. It is the easiest way to use the library, just call this method at the same place you call your analytics tools' track methods with the same parameters.
result, err := avoInspector.TrackSchemaFromEvent("Test Event", map[string]interface{}{
"str": "hello",
"int": 42,
"flt": 3.14,
"bol": true,
"nul": nil,
"lst": []interface{}{"foo", "bar", nil, map[string]interface{}{"d": 42}},
"obj": map[string]interface{}{"a": 1, "b": "two", "c": []interface{}{true, 3.14}},
"unk": complex(1, 2),
"func": func() {},
})
Avo (https://www.avo.app), [email protected]
AvoInspector is available under the MIT license.