lib/analytics.dart (any Dart) · open source (MIT) · ask in plain English

Add analytics to Flutter.

Flutter analytics means tracking screen changes and taps across iOS and Android from one Dart codebase. smolanalytics has no Flutter SDK. You send events with an http POST to /v1/events, which keeps your app light and works the same on both platforms. Then ask your numbers in plain English from the dashboard or your editor.

lib/analytics.dart (any Dart)
// pubspec.yaml: dependencies: http: ^1.0.0
import 'package:http/http.dart' as http;
import 'dart:convert';

const host = 'https://YOUR-INSTANCE';
const key = 'WRITE_KEY';

Future<void> track(String name, String distinctId, [Map<String, dynamic>? props]) {
  return http.post(
    Uri.parse('$host/v1/events'),
    headers: {'Content-Type': 'application/json', 'Authorization': 'Bearer $key'},
    body: jsonEncode({'name': name, 'distinct_id': distinctId, 'properties': props ?? {}}),
  );
}

// batch: POST a JSON array to the same endpoint to save calls
// http.post(..., body: jsonEncode([event1, event2, event3]));

There is no Flutter SDK. This is a plain http POST, so put it in a shared analytics service and call it from route observers and button handlers.

how do I add analytics to flutter?

Flutter analytics means tracking screen changes and taps across iOS and Android from one Dart codebase. smolanalytics has no Flutter SDK. You send events with an http POST to /v1/events, which keeps your app light and works the same on both platforms. Then ask your numbers in plain English from the dashboard or your editor.

Wire track() into a NavigatorObserver so every screen push logs a name like screen_view with the route name in properties, and call it on your key taps (add to cart, upgrade, submit). Use a stable distinct_id per user (your user id after login, a device id before). That gives you funnels and retention without a single native dependency.

Because each call is an HTTP round trip, batch on mobile. Buffer events in a list and flush a JSON array to /v1/events every few seconds or on app background, so you save battery and radio wakeups. Same endpoint, same write key, whether the buffer holds one event or fifty. Then open the dashboard bar and ask where users drop off, no query language.

Honest pricing: 14-day full trial, no credit card. Then Solo $29/mo, never metered on seats or sites. Overage is $5/million with an emailed receipt, the dashboard never locks, and self-hosting the single Go binary is free forever (MIT).

Add analytics to Flutter tonight.

One snippet, or one endpoint. Tomorrow morning the verdict tells you which part of the funnel to fix.

questions

How do I add analytics to Flutter?
Flutter analytics means tracking screen changes and taps across iOS and Android from one Dart codebase. smolanalytics has no Flutter SDK. You send events with an http POST to /v1/events, which keeps your app light and works the same on both platforms. Then ask your numbers in plain English from the dashboard or your editor.
Do I need a cookie banner?
Not in cookieless mode. smolanalytics can run without storing anything on the device, so there is no consent banner to add. You still get visitors, referrers, funnels, retention, and paths, and AI-assistant referrals (chatgpt.com, claude.ai, perplexity.ai) show up as their own channel.
Is it enough for a real product, or just page counts?
It does funnels, retention, paths, cohorts, and a daily verdict on what to fix, from the same events, and you ask it in plain English. It deliberately skips session replay, feature flags, and experiments. If you want a straight answer on what to fix, that you own and can self-host free, it fits.

keep reading