Challenge - 5 Problems
Firebase Analytics Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ ui_behavior
intermediate2:00remaining
Tracking a Custom Event in Firebase Analytics
You want to track a custom event named purchase_complete with a parameter item_id in your Flutter app using Firebase Analytics. Which code snippet correctly logs this event?
Flutter
final FirebaseAnalytics analytics = FirebaseAnalytics.instance; // Your code here to log event
Attempts:
2 left
💡 Hint
Check the method name and parameter names carefully. Firebase Analytics expects specific argument names.
✗ Incorrect
The correct method to log an event is logEvent with named parameters 'name' and 'parameters'. Option A uses the correct syntax and awaits the async call. Option A misses named parameters, causing a syntax error. Option A uses a non-existent method 'log'. Option A uses wrong parameter names and event name casing.
❓ lifecycle
intermediate1:30remaining
When to Initialize Firebase Analytics in Flutter
At which point in a Flutter app's lifecycle should you initialize Firebase Analytics to ensure it tracks user events correctly?
Attempts:
2 left
💡 Hint
Think about when Firebase services should be ready before the UI loads.
✗ Incorrect
Firebase Analytics should be initialized early, typically in main() before runApp(), so it can track all events from app start. Initializing in build() or dispose() is too late or inappropriate. Waiting 10 seconds delays tracking important early events.
🔧 Debug
advanced2:00remaining
Debugging Missing Analytics Events in Flutter
You notice that your custom Firebase Analytics events are not appearing in the Firebase console. Which of the following is the most likely cause?
Attempts:
2 left
💡 Hint
Firebase services must be ready before usage.
✗ Incorrect
If Firebase.initializeApp() is not called before logging events, Firebase Analytics won't work properly and events won't be sent. Using await is correct and allowed. Event names longer than 40 characters (not 100) are invalid but less common cause. Logging inside build() is not recommended but does not prevent events from sending.
🧠 Conceptual
advanced1:30remaining
Understanding Firebase Analytics User Properties
Which statement about Firebase Analytics user properties in Flutter is true?
Attempts:
2 left
💡 Hint
Think about how user properties help analyze user behavior.
✗ Incorrect
User properties are custom attributes you set to describe segments of your user base. They can be set multiple times and help in filtering analytics reports. They are not automatically collected and can be set anytime after initialization. They work on both Android and iOS.
expert
2:30remaining
Tracking Screen Views with Firebase Analytics in Flutter
You want to track screen views in your Flutter app using Firebase Analytics. Which approach correctly sets the current screen name for analytics when navigating between screens?
Flutter
import 'package:firebase_analytics/firebase_analytics.dart'; final FirebaseAnalytics analytics = FirebaseAnalytics.instance; // Inside your screen widget's lifecycle or navigation callback
Attempts:
2 left
💡 Hint
Check the exact method name and parameter names in the Firebase Analytics Flutter API.
✗ Incorrect
The correct method to set the current screen is setCurrentScreen with a named parameter screenName. Option D uses the correct syntax and awaits the async call. Option D logs a generic event but does not set the screen properly. Options A and C use incorrect method names or syntax causing errors.