TopStats SDK

Elixir analytics SDK

A GenServer holds the buffer, so batching, timed flushes and shutdown draining are ordinary OTP - put it in your supervision tree and capture is a cast that never blocks the caller. The phoenix package adds a Plug with route templates from the Phoenix router.

Install

# Hex soon; today:
{:topstats_analytics, git: "https://github.com/top-stats/analytics-elixir-sdk"}

Capture your first event

{:ok, client} = TopstatsAnalytics.start_link(
  api_key: System.fetch_env!("TOPSTATS_API_KEY"),
  default_source: "api")

TopstatsAnalytics.capture(client, "email_sent", %{"template" => "digest"},
  %{actor: "user-88"})
TopstatsAnalytics.flush(client)

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.