TopStats SDK

Go analytics library

Idiomatic Go with functional options and no dependencies - the module path is the install. Capture never blocks on the network; a background goroutine drains a bounded queue. The go-web module adds net/http middleware plus Gin, Echo and Fiber adapters.

Install

go get github.com/top-stats/analytics-go-sdk

Capture your first event

client, err := topstats.New(os.Getenv("TOPSTATS_API_KEY"),
    topstats.WithDefaultSource("api"))

client.Capture("payment_settled", map[string]any{"cents": 4200},
    topstats.WithActor("acct_9"))
client.Shutdown(ctx) // flushes the tail

Behaviour you can rely on

Every other language

Your first event is minutes away.

Twelve language SDKs, middleware for nine web frameworks, plugins for seven games, and raw HTTP - all working today. Free plan, 2M events a month, no card.