Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions docs/analytics/usage/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,17 @@ Below is an example showing how a custom event can be logged. Please be aware th
```jsx
import react, { useEffect } from 'react';
import { View, Button } from 'react-native';
import analytics from '@react-native-firebase/analytics';
import { getAnalytics, logEvent } from '@react-native-firebase/analytics';

const analytics = getAnalytics();

function App() {
return (
<View>
<Button
title="Add To Basket"
onPress={async () =>
await analytics().logEvent('basket', {
await logEvent(analytics, 'basket', {
id: 3745092,
item: 'mens grey t-shirt',
description: ['round neck', 'long sleeved'],
Expand All @@ -91,7 +93,9 @@ Below is a sample of how to use one of the predefined methods the Analytics modu
```jsx
import react, { useEffect } from 'react';
import { View, Button } from 'react-native';
import analytics from '@react-native-firebase/analytics';
import { getAnalytics, logSelectContent } from '@react-native-firebase/analytics';

const analytics = getAnalytics();

function App() {
return (
Expand All @@ -101,7 +105,7 @@ function App() {
// Logs in the firebase analytics console as "select_content" event
// only accepts the two object properties which accept strings.
onPress={async () =>
await analytics().logSelectContent({
await logSelectContent(analytics, {
content_type: 'clothing',
item_id: 'abcd',
})
Expand Down Expand Up @@ -140,9 +144,9 @@ if FirebaseAnalytics.ConsentType.ANALYTICS_STORAGE has been set to FirebaseAnaly
iOS if ConsentType.analyticsStorage has been set to ConsentStatus.denied.

```jsx
import analytics from '@react-native-firebase/analytics';
import { getAnalytics, getAppInstanceId } from '@react-native-firebase/analytics';
// ...
const appInstanceId = await analytics().getAppInstanceId();
const appInstanceId = await getAppInstanceId(getAnalytics());
```

### Web / Other platform instance id
Expand Down
Loading