Skip to main content

Go Server SDK

Backend event tracking for Go services: background batching, retries with backoff and jitter, automatic UUIDv7 idempotency keys. Standard library only; Go 1.22+.

Usage

client, err := hober.NewClient(os.Getenv("HOBER_SERVER_KEY"))
if err != nil { log.Fatal(err) }
defer client.Close(context.Background())

_ = client.Track(hober.Event{
Name: "order.placed",
ExternalID: "user-483", // your user id — resolved by Hober's registry
Properties: map[string]any{"order_id": "ord_921", "total_cents": 12900},
})

_ = client.Identify(ctx, "anon-9f2c", subscriberUUID)

Create the server key under Settings → Server Keys. Full API semantics: Server-Side Event Tracking.

Behavior

  • Batching: events queue in memory and ship in batches of 100 (WithMaxBatchSize) or every 5s (WithFlushInterval); Flush/Close drain synchronously. The queue holds 10k events; beyond that Track returns ErrQueueFull rather than blocking your request path.
  • Retries: 429 (honoring Retry-After) and 5xx retry with exponential backoff + jitter, 4 retries by default; other 4xx are permanent and surface through WithOnError (default: dropped silently — tracking never takes your process down).
  • Idempotency: every event gets a UUIDv7 key unless you set one; supply your own (outbox row id, order id) to make cross-process retries safe.