0
0
Fluttermobile~10 mins

Firebase Analytics in Flutter - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the Firebase Analytics package in Flutter.

Flutter
import '[1]';
Drag options to blanks, or click blank then click option'
Apackage:flutter_analytics/flutter_analytics.dart
Bpackage:flutter/material.dart
Cpackage:firebase_core/firebase_core.dart
Dpackage:firebase_analytics/firebase_analytics.dart
Attempts:
3 left
💡 Hint
Common Mistakes
Importing the wrong package like flutter_analytics or firebase_core instead of firebase_analytics.
2fill in blank
medium

Complete the code to create an instance of FirebaseAnalytics.

Flutter
final FirebaseAnalytics analytics = FirebaseAnalytics[1]();
Drag options to blanks, or click blank then click option'
A.new
B.init
C.instance
D.create
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to call a constructor like FirebaseAnalytics() instead of using the instance property.
3fill in blank
hard

Fix the error in the code to log a custom event named 'purchase' with a parameter 'item_id'.

Flutter
await analytics.logEvent(name: '[1]', parameters: {'item_id': '12345'});
Drag options to blanks, or click blank then click option'
Apurchase
Bpurchase_event
Cbuy
Ditem_purchase
Attempts:
3 left
💡 Hint
Common Mistakes
Using event names with underscores or spaces which Firebase Analytics does not accept.
4fill in blank
hard

Fill both blanks to set the user ID and user property in Firebase Analytics.

Flutter
await analytics.setUserId(id: '[1]');
await analytics.setUserProperty(name: '[2]', value: 'premium');
Drag options to blanks, or click blank then click option'
Auser123
Bsubscription
Cuser_type
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid user property names or mixing user ID with property names.
5fill in blank
hard

Fill all three blanks to log a screen view event with screen name and screen class.

Flutter
await analytics.logScreenView(screenName: '[1]', screenClass: '[2]', [3]);
Drag options to blanks, or click blank then click option'
AscreenClassOverride: 'HomeScreen'
B'HomePage'
C'MainScreen'
DscreenClassOverride: 'MainScreen'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing parameter names or missing the optional screenClassOverride parameter.