TopStats SDK

Swift analytics SDK

Foundation-only - URLSession, JSONSerialization, a serial DispatchQueue for the flush loop - so it runs on macOS and Linux server-side Swift alike. Installable now: SPM straight from the repo URL, no registry wait.

Install

.package(url: "https://github.com/top-stats/analytics-swift-sdk", branch: "master")

Capture your first event

let client = TopStatsClient(apiKey: ProcessInfo.processInfo.environment["TOPSTATS_API_KEY"]!,
    defaultSource: "api")

client.capture("route_completed", properties: ["km": 12.4],
    context: CaptureContext(actor: "rider-7"))
client.shutdown()

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.