Skip to main content
The Go SDK sends events and structured logs from your backend services to Tell. It’s a server SDK — you create a client, pass a user ID on every call, and a background goroutine handles batching and delivery over TCP. Every method takes a context.Context and returns an error. The calling goroutine does about 320 ns of work (serialize, encode, enqueue) and never touches the network.

Installation

Requires Go 1.24+.

Quick start

The client connects to collect.tell.rs:50000, batches up to 100 events, and flushes every 10 seconds or when you call Close.

Configuration

Use one of the two presets, or pass a custom Config struct.
Both presets accept an optional error callback:
For custom settings:
The API key must be a 32-character hex string. NewClient returns an error if it’s invalid.

Tracking events

Every tracking method takes context.Context and userID as its first parameters. Properties are tell.Properties (map[string]interface{}) or nil.
Pass nil instead of tell.Properties{} when you don’t need properties:

Standard event names

The SDK provides constants for common events:
Constants cover user lifecycle, revenue, subscriptions, trials, shopping, engagement, and communication events. Custom string names are always accepted too.

Super properties

Register properties that get merged into every Track, Group, and Revenue call:
Event-specific properties override super properties when keys conflict.

Structured logging

Send logs alongside events through the same pipeline. Each log has an RFC 5424 severity level.
The service parameter is *string — use tell.Ptr("myservice") to pass a value, or nil to default to "app". Convenience methods are available for all nine levels: LogEmergency, LogAlert, LogCritical, LogError, LogWarning, LogNotice, LogInfo, LogDebug, and LogTrace. For full control, use the Log method with a LogEntry struct:

Properties

tell.Properties is map[string]interface{}. Supported value types:
  • string
  • int, int32, int64, float32, float64
  • bool
  • time.Time
  • []interface{} (arrays)
  • map[string]interface{} (nested objects)
  • nil

Lifecycle

Always call Close before your process exits to avoid losing buffered events. Use defer client.Close(ctx) right after creating the client.

Goroutine safety

The client is safe to share across goroutines:

Error handling

Constructor errors are returned directly:
Tracking and logging methods return validation errors for invalid input. Network errors are handled internally with retries and reported via the OnError callback:

Advanced

Configuration reference

Validation rules

Performance

Caller latency — serialize, encode, and enqueue (Apple M4 Pro): Delivery throughput — batched and sent over TCP: