diff --git a/docs/analytics/usage/index.md b/docs/analytics/usage/index.md index 6a7745bdf0..17950a4d76 100644 --- a/docs/analytics/usage/index.md +++ b/docs/analytics/usage/index.md @@ -38,7 +38,9 @@ Analytics automatically logs some [events](https://support.google.com/analytics/ # Usage -Analytics offers a wealth of [Predefined Events](#predefined-events) to track user behavior. Analytics also offers folks the ability to log [Custom Events](#custom-events) . If you're already familiar with Google Analytics, this method is equivalent to using the event command in [gtag.js](https://developers.google.com/gtagjs/). +Analytics offers a wealth of [Predefined Events](#predefined-events) to track user behavior. Analytics also offers folks the ability to log [Custom Events](#custom-events) . If you're already familiar with Google Analytics, this method is equivalent to using the event command in [gtag.js](https://developers.google.com/gtagjs/). + +> Note: All code examples below use the modular APIs (v22+). ## Event Parameters @@ -56,9 +58,11 @@ Different event types require different parameters (some require no parameters, Below is an example showing how a custom event can be logged. Please be aware that primitive data types or arrays of primitive data types are logged in your Firebase Analytics console. ```jsx -import react, { useEffect } from 'react'; -import { View, Button } from 'react-native'; -import analytics from '@react-native-firebase/analytics'; +import react, { useEffect } from "react"; +import { View, Button } from "react-native"; +import { getAnalytics, logEvent } from "@react-native-firebase/analytics"; + +const analytics = getAnalytics(); function App() { return ( @@ -66,11 +70,11 @@ function App() {