flutter_estatisticas 0.0.9
flutter_estatisticas: ^0.0.9 copied to clipboard
Simple Umami Analytics Flutter SDK
Flutter Umami Analytics Integration #
This package integrates Umami Analytics into your Flutter app, allowing navigation tracking and custom event logging.
Installation #
Add to your pubspec.yaml:
dependencies:
flutter_estatisticas: ^0.0.9
Usage #
1. Import the services #
import 'package:flutter_estatisticas/umami_service.dart';
import 'package:flutter_estatisticas/umami_navigation_observer.dart';
2. Instantiate the Umami service #
final umamiService = UmamiService(
endpoint: 'https://michelmelo.pt',
website: 'id-website', // Your Umami website ID
hostname: 'seusite.com.pt', // Your app's hostname
);
3. Add the observer to your MaterialApp #
MaterialApp(
// ... other parameters ...
navigatorObservers: [
UmamiNavigationObserver(umamiService),
],
)
4. Send custom events #
Simple click event
umamiService.enviarClique(context, 'spotify');
Replace 'spotify' with your desired event name.
Custom event
umamiService.enviarEvento(
context,
nome: 'event-name',
dados: {
'key': 'value',
'foo': 'bar',
},
);
Use enviarEvento to send events with additional data.
Notes #
- The
websiteparameter should be your site ID from the Umami dashboard. - The
hostnameshould be your app's domain or identifier. - The observer will automatically track navigation events in your app.
- Use
enviarCliquefor simple events andenviarEventofor custom events with extra data.
License #
MIT