0
0
Firebasecloud~10 mins

Custom events in Firebase - Interactive Code Practice

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

Complete the code to log a custom event named "purchase" using Firebase Analytics.

Firebase
firebase.analytics().logEvent([1]);
Drag options to blanks, or click blank then click option'
A"purchase"
B"login"
C"error"
D"click"
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the event name
Using a predefined event name instead of the custom one
2fill in blank
medium

Complete the code to log a custom event "level_up" with a parameter "level" set to 5.

Firebase
firebase.analytics().logEvent("level_up", [1]);
Drag options to blanks, or click blank then click option'
A["level", 5]
B"level=5"
Clevel = 5
D{level: 5}
Attempts:
3 left
💡 Hint
Common Mistakes
Using an array instead of an object
Passing a string instead of an object
Using assignment syntax instead of an object
3fill in blank
hard

Fix the error in the code to correctly log a custom event "share" with parameter "method" set to "email".

Firebase
firebase.analytics().logEvent("share", [1]);
Drag options to blanks, or click blank then click option'
A"method: email"
B{method: "email"}
C[method: "email"]
D{method = "email"}
Attempts:
3 left
💡 Hint
Common Mistakes
Using equals (=) inside object
Using square brackets instead of curly braces
Passing parameters as a string
4fill in blank
hard

Fill both blanks to log a custom event "tutorial_complete" with parameters "step" set to 3 and "success" set to true.

Firebase
firebase.analytics().logEvent([1], [2]);
Drag options to blanks, or click blank then click option'
A"tutorial_complete"
B{step: 3, success: true}
C"tutorial_start"
D{step: 1, success: false}
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping event name and parameters
Using wrong event name
Passing parameters as a string
5fill in blank
hard

Fill both blanks to log a custom event "purchase" with parameters "item" set to "sword", "price" set to 10, and "currency" set to "USD".

Firebase
firebase.analytics().logEvent([1], [2]);
Drag options to blanks, or click blank then click option'
A"purchase"
B{item: "sword", price: 10, currency: "USD"}
C{item: "shield", price: 15, currency: "EUR"}
D"sale"
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong event name
Incorrect parameter keys or values
Passing parameters as a string