DevFeedbackHub Analytics SDK

Flutter SDK for tracking tester behavior and rewarding goal achievements in DevFeedbackHub.

Features

  • Automatic tester identification - Device ID based, no user input required
  • Event tracking - Track any custom events in your app
  • Goal completion notifications - Optional snackbar when testers achieve goals
  • Owner preview mode - Test SDK behavior without earning credits

Installation

Add to your pubspec.yaml:

dependencies:
  devfeedbackhub_analytics: ^1.0.0

Usage

Initialize

import 'package:devfeedbackhub_analytics/devfeedbackhub_analytics.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Initialize with your request ID from DevFeedbackHub
  await DFHAnalytics.init('your-request-id');

  runApp(MyApp());
}

Track Events

// Track events anywhere in your app
DFHAnalytics.track('app_open');
DFHAnalytics.track('purchase');
DFHAnalytics.track('share');

Enable Notifications (Optional)

Show a snackbar when testers achieve goals:

final scaffoldMessengerKey = GlobalKey<ScaffoldMessengerState>();

await DFHAnalytics.init(
  'your-request-id',
  showNotification: true,
  messengerKey: scaffoldMessengerKey,
  notificationConfig: DFHNotificationConfig(
    position: DFHPosition.bottom,
    backgroundColor: Colors.green,
    textColor: Colors.white,
    duration: Duration(seconds: 3),
    icon: Icons.celebration,
  ),
);

// Use the key in your MaterialApp
MaterialApp(
  scaffoldMessengerKey: scaffoldMessengerKey,
  // ...
)

How It Works

  1. Developer activates Analytics in DevFeedbackHub app
  2. Developer sets up reward goals (e.g., "purchase", "share")
  3. Developer integrates this SDK with the request ID
  4. Testers use the app - SDK automatically identifies them
  5. When testers achieve goals, they earn credits automatically
  6. Optional: SDK shows a celebration snackbar

Owner Preview Mode

When the app owner tests the SDK:

  • Events are tracked normally
  • Goal completion shows preview notification (orange snackbar)
  • No credits are awarded (credits are for testers only)

Additional Information