Analytics
Events, sessions, and retention — track what users do, when they came back, and what kept them engaged.
Analytics is one of the seven canonical Amba categories. It covers three primitives:
- Events — every
Amba.events.track(name, properties)call is a queryable row in your project's event log. Used for segment evaluation, downstream webhooks, and ad-hoc product analysis. - Sessions — start/end timestamps with device metadata, recorded automatically by the SDK via app lifecycle hooks. The basis for active-user counts, session-duration histograms, and "lapsed" segment rules.
- Retention — cohort-style queries derived from events and sessions. Built on top of the first two primitives; no separate retention table.
Analytics primitives feed every other category:
- Engagement — rule-based segments evaluate against the event stream every 15 minutes.
- Gamification — XP rules, achievement unlocks, and streak progress all derive from
events.trackcalls. - Economy — currency grants and inventory updates emit events that show up in the same stream.
How to track an event
Events require an authenticated session (anonymous is fine). Properties are arbitrary JSON. See SDK · Events for the full per-platform reference, and the Admin API · Events for server-side listing and counting.
How sessions are recorded
The SDK calls /v1/client/sessions/start on app foreground and /v1/client/sessions/end on background (or beforeunload on web). You generally don't call these endpoints manually — they're driven by app lifecycle. See Platform · Sessions for the wire format and the manual-control APIs.
Querying analytics
| What | Where |
|---|---|
| List a user's recent events | Admin API · GET /v1/admin/projects/:p/users/:u/events |
| Count events in a window | Admin API · GET /v1/admin/projects/:p/events/count |
| Tail the live event feed | Admin API · GET /v1/admin/projects/:p/events?stream=1 |
| Aggregate analytics for the project | Admin API · GET /v1/admin/projects/:p/analytics |
| Session history for a user | Platform · Sessions |
The same surface is reachable through the MCP tools — amba_events_list, amba_events_count, amba_analytics_get, amba_sessions_list, amba_sessions_analytics — so your AI agent can pull the same numbers without leaving the editor.
See also
- SDK · Events — per-platform
events.trackreference (Web, Node, React, React Native, Swift, Kotlin, Dart, C#). - Platform · Sessions — session-record wire format and manual control.
- Segments — turn the event stream into rule-based audiences.
- Webhooks — fan analytics events out to your other systems.