Complete the code to log a custom event named "purchase" using Firebase Analytics.
firebase.analytics().logEvent([1]);The logEvent method requires the event name as a string. Here, "purchase" is the custom event we want to log.
Complete the code to log a custom event "level_up" with a parameter "level" set to 5.
firebase.analytics().logEvent("level_up", [1]);
The second argument to logEvent is an object with key-value pairs representing parameters. Here, {level: 5} correctly sets the "level" parameter.
Fix the error in the code to correctly log a custom event "share" with parameter "method" set to "email".
firebase.analytics().logEvent("share", [1]);
Parameters must be passed as an object with key-value pairs using colon (:). The correct syntax is {method: "email"}.
Fill both blanks to log a custom event "tutorial_complete" with parameters "step" set to 3 and "success" set to true.
firebase.analytics().logEvent([1], [2]);
The first argument is the event name as a string. The second argument is an object with parameters. Here, "tutorial_complete" and {step: 3, success: true} are correct.
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.analytics().logEvent([1], [2]);
The event name is "purchase" and the parameters object includes the correct keys and values for item, price, and currency.