Complete the code to initialize Firebase Analytics in your app.
const analytics = [1]();The getAnalytics() function initializes Firebase Analytics for your app.
Complete the code to log a custom event named 'purchase' with Firebase Analytics.
analytics.[1]('purchase', { item: 'book', price: 9.99 });
The logEvent method sends custom event data to Firebase Analytics.
Fix the error in the code to correctly import Firebase Analytics.
import { [1] } from 'firebase/analytics';
The correct import is getAnalytics from 'firebase/analytics'.
Fill both blanks to send an event with a dynamic parameter.
analytics.[1]('select_content', { content_type: [2] });
Use logEvent to send events and specify the content type as 'article'.
Fill all three blanks to initialize Firebase app, get analytics, and log a 'login' event.
const app = [1](firebaseConfig); const analytics = [2](app); analytics.[3]('login');
First, initialize the app with initializeApp, then get analytics with getAnalytics, and finally log the event with logEvent.