firebase_analytics_monitor 1.0.1
firebase_analytics_monitor: ^1.0.1 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:
famon monitor --show-only my_event --show-only another_event
# or using short form:
famon monitor -s my_event -s another_event
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] my_custom_event
Parameters:
param_one: value1
param_two: value2
[12-25 10:31:15.456] another_event
Parameters:
screen_name: SomeScreen
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
π§ 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