Skip to content

Repository files navigation

Example Analytics Server

Open-source Go reference for accepting Blazium Engine analytics events. Stores JSONL on the local filesystem. Not a hosted product.

Module test project: analytics_module_tests.

Run

go run . -addr 127.0.0.1:8091 -data ./analytics_store
go run . -addr 127.0.0.1:8091 -data ./analytics_store -api-key public-client-key

Copy .env.example to .env and set ANALYTICS_API_KEY if you want X-API-Key checks. Do not commit .env.

go test ./...

Docker:

docker compose up --build --wait

Healthcheck is GET /health on port 8091.

HTTP contract

Method Path Role
GET /health Liveness
POST /v1/events One event object, an array, or { "events": [...] }
GET /v1/events Query app_id, build_id, anonymous, limit

Optional header: X-API-Key. Max body 8 MiB. CORS enabled. Empty app_id is rejected.

Events are stored as analytics_store/{app_id}/{build_id}.jsonl (_none when build_id is empty).

Event JSON

Identity fields are top-level. Anonymous events must omit device_uid.

{
  "app_id": "my-game",
  "build_id": "1.2.0+gabcdef",
  "app_version": "1.2.0",
  "build_channel": "beta",
  "engine_version": "4.8.0.blazium",
  "session_id": "uuid",
  "anonymous": true,
  "event": "session_start",
  "timestamp": "2026-08-17T00:00:00Z",
  "properties": {}
}

Identified events add "anonymous": false and "device_uid": "<OS.get_unique_id()>".

curl

curl -sS http://127.0.0.1:8091/health
curl -sS -H "Content-Type: application/json" -d '{"app_id":"my-game","event":"session_start","anonymous":true}' http://127.0.0.1:8091/v1/events
curl -sS "http://127.0.0.1:8091/v1/events?app_id=my-game"

License

MIT — see LICENSE.

About

Example Go ingest server for Blazium Analytics events.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages