dashi 1.0.1 copy "dashi: ^1.0.1" to clipboard
dashi: ^1.0.1 copied to clipboard

Pure Dart client for Umami Analytics — pageviews, custom events, identify, and a pluggable offline queue. Web included.

example/main.dart

// A minimal example of the dashi Umami Analytics client.
//
// Point `endpoint`/`websiteId` at your own Umami instance (>= 3.1.0) and run it.
import 'package:dashi/dashi.dart';

Future<void> main() async {
  final umami = UmamiClient(
    endpoint: Uri.parse('https://umami.example.com'),
    websiteId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
    hostname: 'com.example.app',
    // The core collects nothing itself — you describe the context.
    // On web, set `userAgent: null` (the browser sends its own).
    contextProvider: () => const UmamiContext(
      language: 'en-US',
      screen: '1080x2400',
      userAgent: 'MyApp/1.0 (com.example.app; Dart)',
    ),
  );

  // Track a page view (a screen was opened).
  await umami.pageView(url: '/home', title: 'Home');

  // Track a custom event with structured data.
  await umami.event('signup', url: '/onboarding', data: {'plan': 'pro'});

  // Identify the current user (e.g. right after login). Every event sent
  // afterwards is attributed to this id.
  await umami.identify('user-42');

  // Best-effort flush of any queued events, then release resources.
  await umami.dispose();
}
0
likes
160
points
108
downloads

Documentation

API reference

Publisher

verified publisherowlnext.fr

Weekly Downloads

Pure Dart client for Umami Analytics — pageviews, custom events, identify, and a pluggable offline queue. Web included.

Repository (GitHub)
View/report issues

Topics

#analytics #umami #tracking #telemetry

License

MIT (license)

Dependencies

dio, http, lucky_dart

More

Packages that depend on dashi