devfeedbackhub_analytics 1.0.0
devfeedbackhub_analytics: ^1.0.0 copied to clipboard
DevFeedbackHub Analytics SDK - Track tester behavior and reward goal achievements
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 #
- Developer activates Analytics in DevFeedbackHub app
- Developer sets up reward goals (e.g., "purchase", "share")
- Developer integrates this SDK with the request ID
- Testers use the app - SDK automatically identifies them
- When testers achieve goals, they earn credits automatically
- 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 #
- Package: pub.flutter-io.cn/packages/devfeedbackhub_analytics
- Issues: GitHub Issues