Analytics: events, analyses and funnels
What your users do inside your app, measured by the SDK and read in the studio: sessions, screens, product events, analyses, funnels, feature flags and A/B tests.
The SDK first, the dashboard after.
What you need
| Platform | Package | Symbol |
|---|---|---|
| iOS 16 | SPM product AppwinAnalytics | AppwinAnalytics |
| Android 7.0 (API 24) | io.appwin:appwin-analytics | io.appwin.analytics.AppwinAnalytics |
Native only. Neither the Flutter plugin nor the React Native bridge exposes Analytics today - Community, Support and Notifications do. On those two platforms the product is still to be wired.
Two conditions before an event leaves:
AppwinCore.configurecalled at launch - see Install the SDK.initialize()answeringready. It is what starts the capture: sessions and installs are only recorded from that point on.
The heavy lifting - persisted queue, batching, offline buffering, session
tracking, consent - lives in AppwinCore. The Analytics module is the
product's public surface, the way AppwinSupport is of its own.
Capturing
import AppwinAnalytics
AppwinCore.configure(projectAppId: "your-app-id")
if await AppwinAnalytics.initialize().isReady {
AppwinAnalytics.screen("home")
AppwinAnalytics.track("purchase", props: [
"plan": "pro",
"seats": 3,
])
}
track never blocks and never throws: the event is written to disk and uploaded
in batches, offline included.
What the SDK captures without you: session_start, session_end (with its
duration), app_install, app_update. screen_view comes from your call to
screen.
The naming rules
| Rule | Detail |
|---|---|
| Event name | ^[a-z][a-z0-9_]{0,63}$ - lowercase, digits, underscores |
| Reserved names | session_start, session_end, screen_view, app_install, app_update: the SDK emits them, you do not shadow them |
| Properties | 20 keys at most; values as string, boolean or number |
| Lengths | String values truncated to 256 characters, screen names to 128 |
An invalid event is dropped, with a debug log. No exception: a measurement must not bring down the app it measures.
Consent
The default is granted - an opt-out. Most studios fall under the first-party
audience-measurement exemption and have no consent screen to show.
If yours has one, set unknown at launch: events are captured and persisted,
but nothing is uploaded. Then relay the user's answer.
// At launch, before configure if you like.
AppwinAnalytics.setConsent(.unknown)
// Then, once the user has answered:
AppwinAnalytics.setConsent(.granted) // uploads the backlog
AppwinAnalytics.setConsent(.denied) // purges it and mutes capture
| Value | Capture | Upload |
|---|---|---|
granted | Yes | Yes, the backlog goes with it |
unknown | Yes, to disk | No |
denied | No | No, and the queue is purged |
The public surface
| Function | What it does |
|---|---|
initialize() | Asks the server for its verdict and starts the capture. Before anything else. |
track(name, props) | Queues a custom event. Does not block, does not throw. |
screen(name) | Emits the reserved screen_view. Screen names feed funnel steps and breakdowns. |
flush() | Forces an immediate upload of the queue. Rarely needed: it already flushes on volume, on a timer, and when the app goes to the background. |
setConsent(consent) | Sets the GDPR consent: granted, unknown or denied. |
isReady | The last verdict from initialize(), without another call. |
Reading the data
Analytics in the sidebar, five entries:
| Entry | What you do there |
|---|---|
| Home | The health of the stream (last event received), pinned dashboards and recently viewed ones |
| Analyses | An analysis is a saved query: a chart over time, a funnel or a retention grid |
| Dashboards | Analyses laid out as tiles on a shared board, with its own period filters |
| Feature flags | One switch per key, with a rollout percentage and variants |
| A/B tests | A multivariate flag plus one metric, and the results per variant |
An analysis is created from New analysis, never in SQL. Filters set at dashboard level are merged onto each of its tiles: the period replaces the analysis's own, nothing is duplicated.
The month's event counter is shown on the page. Past your plan's quota, new events are dropped - no silent billing, but no catching up either.
Next
- Installation - install and initialise the SDK
- Notifications - trigger a message from an event
- Identity - what links a device to a person