Flutter Umami

License: MIT

Simple Umami Analytics Flutter SDK made by Solvro Team

Installation 💻

❗ In order to start using Flutter Umami you must have the Flutter SDK installed on your machine.

Install via flutter pub add:

flutter pub add flutter_umami

Usage 🚀

Initialize Flutter Umami

First, create an instance of FlutterUmami by calling the create method:

WidgetsFlutterBinding.ensureInitialized();
final umami = await FlutterUmami.create(
  url: 'https://my.analytics.server', // Your Umami instance URL
  id: '9f65dd3f-f2be-4b27-8b58-d76f83510beb', // Your site ID from Umami dashboard
  hostname: 'com.my.app', // Your app's hostname
  locale: 'en-US', // User's locale or get from the context or somewhere
  isEnabled: kIsRelease // recommended
);

Track Screen Views

You can track screen views in two ways:

MaterialApp(
  navigatorObservers: [
    UmamiNavigationObserver(umami),
  ],
  // ... rest of your app configuration
);
await umami.trackScreenView(
  'home_screen',
  referrer: 'previous_screen', // Optional
);

Track Events

Track custom events with optional values:

await umami.trackEvent(
  eventType: 'button_click',
  eventValue: 'sign_up', // Optional
  screenName: 'home_screen', // Optional
);

Credits

Based on some discontinued package: https://pub.dev/packages/umami_tracker


Libraries

flutter_umami
Simple Umami Analytics Flutter SDK made by Solvro.