firebase_analytics_monitor 1.0.0
firebase_analytics_monitor: ^1.0.0 copied to clipboard
A command-line tool to monitor Firebase Analytics events from logcat.
๐ฅ Firebase Analytics Monitor (famon) #
A powerful command-line tool for real-time monitoring and filtering of Firebase Analytics events from Android logcat. Perfect for developers and QA engineers working with Firebase Analytics implementations.
โจ Features #
- ๐ Real-time monitoring: Stream Firebase Analytics events as they happen
- ๐ฏ Smart filtering: Hide noisy events or show only specific ones
- ๐จ Beautiful output: Colorized, well-formatted event display with emoji icons
- ๐ Smart suggestions: Get recommendations for filtering based on session data
- ๐ Session statistics: Track event frequency and patterns
- โก Event parsing: Comprehensive parsing of parameters and item arrays
- ๐ Developer-friendly: Designed for debugging and analytics validation
๐ Installation #
Global Installation via Pub #
dart pub global activate firebase_analytics_monitor
Local Development Installation #
dart pub global activate --source=path <path to this package>
From Source #
git clone <repository-url>
cd firebase_analytics_monitor
dart pub get
dart compile exe bin/famon.dart -o famon
# Move famon to your PATH
๐ Prerequisites #
Before using famon, ensure you have:
- โ Android SDK platform-tools installed
- โ
adbcommand available in your PATH - โ Android device or emulator connected
- โ USB debugging enabled on your device
- โ App with Firebase Analytics running
Verify your setup:
adb devices # Should show your connected device
adb logcat -s FA-SVC | head # Should show Firebase Analytics logs
๐ฏ Usage #
Basic Monitoring #
Monitor all Firebase Analytics events:
famon monitor
Filter Events #
Hide specific noisy events:
famon monitor --hide screen_view --hide _vs
Show only specific events (e.g., e-commerce events):
famon monitor --show-only purchase --show-only add_to_cart
# or using short form:
famon monitor -s purchase -s add_to_cart
Advanced Options #
Monitor with smart suggestions and statistics:
famon monitor --suggestions --stats
Disable colors (useful for CI/CD or logging):
famon monitor --no-color
Get Help #
famon help # Detailed help with examples
famon --help # Basic usage information
famon --version # Show version
๐ Example Output #
๐ฅ Firebase Analytics Monitor Started
๐ฑ Connecting to adb logcat...
Press Ctrl+C to stop monitoring
๐ [12-25 10:30:45.123] purchase
Parameters:
๐ฐ currency: USD
๐ฐ value: 29.99
๐ฐ transaction_id: txn_abc123
method: credit_card
๐ฆ Items:
Item 1:
item_id: sku_123
item_name: Premium T-Shirt
๐ธ item_customization: Large, Blue
price: 29.99
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฑ [12-25 10:31:15.456] screen_view
Parameters:
screen_name: ProductDetail
screen_class: MainActivity
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ก Smart Suggestions:
Most frequent events: screen_view, _vs, app_update, user_engagement
Consider hiding: screen_view, _vs
Use: famon monitor --hide screen_view --hide _vs
๐ Session Stats:
Unique Events: 8
Total Events: 45
Most Frequent: screen_view (23)
๐จ Event Types & Icons #
The tool automatically assigns relevant emoji icons to different event types:
- ๐ E-commerce events:
purchase,add_to_cart,begin_checkout, etc. - โค๏ธ Engagement:
add_to_wishlist - ๐ฑ App events:
screen_view,app_open - ๐ Generic events: All other Firebase Analytics events
๐ง Command Reference #
Monitor Command #
famon monitor [OPTIONS]
Options:
--hide EVENT_NAME: Hide specific event names (can be used multiple times)-s, --show-only EVENT_NAME: Only show specified events (can be used multiple times)--no-color: Disable colored output--suggestions: Show smart filtering suggestions based on session data--stats: Display session statistics periodically--help: Show help for the monitor command
Global Options #
-v, --version: Show version information--verbose: Enable verbose logging--help: Show general help
๐งช Testing Your Setup #
-
Test adb connection:
adb devices -
Test Firebase Analytics logs:
adb logcat -s FA-SVC | head -20 -
Test with sample events:
- Open your app with Firebase Analytics
- Navigate through screens or trigger events
- Run
famon monitorto see events in real-time
๐ Troubleshooting #
"adb: command not found" #
- Install Android SDK platform-tools
- Add platform-tools to your PATH
"No devices found" #
- Connect your Android device via USB
- Enable USB debugging in Developer Options
- Try
adb kill-server && adb start-server
"No Firebase Analytics events" #
- Ensure your app has Firebase Analytics integrated
- Check that events are being sent (may have delays)
- Verify Firebase Analytics is properly configured
"Permission denied" errors #
- Check USB debugging permissions on device
- Try different USB cable or port
"Not all event parameters are showing" #
If you're seeing events but missing parameters, this could be due to:
- Log format variations: Firebase Analytics uses different log formats
- Parameter parsing issues: Complex parameter structures may need adjustment
To debug parameter parsing:
# First, check the raw Firebase Analytics logs
adb logcat -s FA-SVC | head -10
# Look for patterns like:
# Logging event: origin=app,name=EVENT_NAME,params=Bundle[{param1=value1, param2=value2}]
Common log formats supported:
Logging event: origin=app,name=EVENT_NAME,params=Bundle[{...}]Event logged: EVENT_NAME params:Bundle[{...}]FA-SVC event_name:EVENT_NAME
If parameters are still missing:
- Check if the Bundle format in your logs matches the expected patterns
- Some newer Firebase SDK versions may use different formats
- Parameters with special characters or nested objects may need additional parsing
Example of expected vs actual log format:
Expected:
Logging event: origin=app,name=view_cart,params=Bundle[{value=0, currency=GBP, login_mode=email_login}]
If your logs look different, please open an issue with a sample log line for format support.
๐ค Contributing #
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Development Setup #
git clone <repository-url>
cd firebase_analytics_monitor
dart pub get
dart pub run build_runner build # Generate model files
Running Tests #
dart test # Run all tests
dart test --coverage=coverage # Run with coverage
dart pub run test # Alternative test command
To view the generated coverage report you can use [lcov](https://github.com/linux-test-project/lcov)
.
```sh
# Generate Coverage Report
$ genhtml coverage/lcov.info -o coverage/
# Open Coverage Report
$ open coverage/index.html