Privacy-first analytics for Flutter
Two calls add analytics to a Flutter app: configure once, then track events. No IDFA, no Advertising ID, no device fingerprints. Runs on iOS, Android, macOS, Linux and Windows.
Free for one app and 20,000 events a month, no card needed. Source on GitHub
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// 1. Configure once at launch
await Respectlytics.configure(apiKey: 'your-api-key');
runApp(const MyApp());
}
// 2. Track events anywhere
await Respectlytics.track('purchase_completed');
Install
Add the package with the Flutter CLI, or list it in pubspec.yaml and run flutter pub get.
flutter pub add respectlytics_flutter
dependencies:
respectlytics_flutter: ^3.0.0
Flutter web is not supported.
Configure once, track anywhere
Call configure() in main() before runApp(), then track() wherever something happens.
import 'package:flutter/material.dart';
import 'package:respectlytics_flutter/respectlytics_flutter.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Respectlytics.configure(apiKey: 'your-api-key');
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('My App')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () async {
await Respectlytics.track('signup_started');
},
child: const Text('Sign Up'),
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () async {
await Respectlytics.track('purchase_completed');
},
child: const Text('Purchase'),
),
],
),
),
),
);
}
}
Hosting the server yourself? Pass its address to configure(). The open source edition runs the same server.
await Respectlytics.configure(
apiKey: 'your-api-key',
baseUrl: 'https://analytics.example.com/api/v1',
);
The whole API
Three methods. An event carries its name and nothing else.
configure({required String apiKey})- Starts the SDK. Call it once in main(), before runApp().
track(String eventName)- Records an event. There are no properties, by design.
flush()- Sends queued events now. Rarely needed: the SDK sends every 30 seconds, when 10 events are queued, and when the app goes to the background.
What leaves the app
Five fields per event, the same in every SDK. The API refuses anything else.
Stored for each event
event_name- the name you pass to track()
timestamp- when it happened
session_id- random, kept in memory, replaced every two hours and on each launch
platform- the operating system
country- looked up on the server from the IP address, which is then discarded
Never collected
- the IDFA, the Advertising ID or any other device identifier
- a fingerprint of the device
- user IDs, names or emails
- properties on events (why)
- anything written to the device
Filling in the App Store privacy label and the Google Play Data Safety form? The privacy disclosure guide walks through each question for the data Respectlytics handles.
Coming from Firebase Analytics
The calls map one to one. The parameters and the user IDs go away.
Replace each FirebaseAnalytics.instance.logEvent() with Respectlytics.track() and drop its parameters. Remove setUserId() and setUserProperty() calls: Respectlytics has no user IDs and no user properties.
Questions developers ask
What the SDK does, and what it leaves out on purpose.
Does the SDK read the IDFA or the Advertising ID?
No. It never reads the IDFA, the Android Advertising ID or any other device identifier, and it does not fingerprint the device. The only ID is a random session ID kept in memory, replaced every two hours and on each launch.
Which platforms does it support?
iOS, Android, macOS, Linux and Windows. Flutter web is not supported.
Does it work offline?
Events wait in memory and are sent every 30 seconds, when 10 are queued, or when the app goes to the background. Offline, they stay in memory until the connection returns. Nothing is written to the device, so events not yet sent are lost if the app is force-quit.
Why can't I attach properties to an event?
Because properties are where personal data slips into analytics: an email in a parameter, a name in a label. The API accepts four fields from the app and rejects any other, so it cannot happen by accident. Put the detail you need in the event name instead, such as premium_plan_selected.
Does it work with Expo?
This package is for Flutter. For React Native and Expo, use the respectlytics-react-native package.
Other SDKs
The same five fields and the same three calls in each.
What sets the SDK apart
The choices behind it, and what each one means for your app.
What to track
Event plans for common funnels, with the calls in each SDK.
Try it on your own app
Free for one app and 20,000 events a month, no card needed. Unlimited apps on every paid plan.