Analytics (Mixpanel)
Usage events (screens, clicks, conversions) to understand how people use the app.
Without analytics you launch the app blind: you don't know which screen trips users up, which button gets clicked, or where in the funnel people give up. Mixpanel solves this.
The kit ships with Mixpanel enabled by default and an AnalyticsObserver that logs every navigation automatically.
Implementation
Via MCP: ask your assistant "add analytics to my project". It runs add_feature for you. See Kasy MCP.
-
Run:
kasy add analyticsThe CLI asks for your Mixpanel token and saves it in the project.
-
To get the token:
- Create an account at mixpanel.com (free tier)
- Create Project → name it
- Settings → Project Settings → copy the Project Token
- Paste it into
kasy add analyticswhen asked
-
To configure it later, without going through the CLI:
# .env MIXPANEL_TOKEN=your_token_hereVia MCP: paste the token in chat and ask "set up Mixpanel" — the assistant writes it with
configure_project_keys. See Kasy MCP.
Information
What gets logged automatically
| Event | When it fires |
|---|---|
Screen View | Every navigation between screens |
App Open | App boot |
Login | Social or email login |
Signup | New sign-up |
Purchase | Subscription purchase (RevenueCat or Stripe) |
Subscription Renewed | Automatic renewal |
You don't need to add a single line of code for these events.
Logging a custom event
import 'package:kasy_kit/core/data/api/analytics_api.dart';
ref.read(analyticsApiProvider).trackEvent(
'Workout Started',
properties: {
'workout_type': 'cardio',
'duration_min': 30,
},
);Good naming conventions:
- Past tense verb:
Workout Started,Recipe Saved,Lesson Completed - Spaces between words (more readable in the dashboard than
workout_started) - Properties in snake_case
Identifying the user
The kit calls identify automatically when the user logs in. You see who did what in the dashboard: it doesn't stay anonymous.
To add profile attributes:
ref.read(analyticsApiProvider).setUserProperties({
'plan': 'premium',
'signup_date': DateTime.now().toIso8601String(),
});Where to see the data
mixpanel.com → your project. A few useful screens to start with:
- Events → raw list of everything coming in
- Funnels → screen A → screen B → subscription (where you're losing people)
- Retention → how many users come back on day 1, day 7, day 30
- Insights → custom charts for any event
Privacy (GDPR / LGPD)
- In production, the user ID is sent along. If you don't want that, you can pass
nullto identify and use just the device's anonymous ID. - Mixpanel has an opt-out:
Mixpanel.optOutTracking()turns off tracking for that user (useful on privacy screens). - Events go to Mixpanel's servers in the US. Mention this in your terms of use.
Last updated on 08/02/2026

