Reputation: 81
I want to use firebase analytics in react native. I have added the lib,
but when i use the await analytics().logEvent("event_name")
it returns null
and event is also not added in firebase analytic console.
Any one have any idea what's wrong?
<Button
title="Add To Basket"
onPress={async () =>
await analytics().logEvent('basket', {
id: 3745092,
item: 'mens grey t-shirt',
description: ['round neck', 'long sleeved'],
size: 'L',
})
}
/>
Upvotes: 3
Views: 2625
Reputation: 111
I had the same issue when I started with analytics.
Firebase says it takes around 24 hours for the events to be visible on console.
Also the logEvent
has a return type of void
, hence you see null
being returned. So don't worry regarding that aspect unless you have an error.
So, I would suggest you to wait for the changes to be reflected.
For Development purposes we would need to see Realtime events, and Firebase has DebugView for that. For details, refer this document: https://firebase.google.com/docs/analytics/debugview
Upvotes: 2