-
Notifications
You must be signed in to change notification settings - Fork 888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FR: Firebase Analytics support in Expo #2244
Comments
I'm with the same problem. I developed an application for a client entirely with Expo in the same version of the SDK you mentioned and I need to install Firebase to follow up and later use analysis and I come to find out that we have to expel only from expo. That was not going to be a problem if the push notifications were not entirely based on Expo :( Hopefully add support for this functionality in Expo as it would be of great help. |
I'd recommend not ejecting if your only concern is using Firebase. Life inside a managed expo app is really nice compared to ejecting. My project has gone from managed -> ejected -> managed, because managed life is just so much more convenient. Expo has first-party support for segment analytics, and if you're a startup you can get it for free for 2 years https://segment.com/industry/startups/ See here for the docs https://docs.expo.io/versions/latest/sdk/segment/ Looks like you can connect segment to firebase as well, although I haven't tried it yet. I'd rather have used firebase from the beginning but until there's library support it's just a massive hassle, and having tried it I'd advise against it for RN apps for the time being. With that said it's obviously something that Google are devoting a lot of time and energy to, so I hope this comment becomes out of date soon. |
I'm with the same problem too. I developed an application for entirely with Expo. The project has also a web Application that is configured with Google Analytics. Using Segment or other tools, will split the analytics data in to places. I have attempted to configure in a Managed expo React Native application. When importing firebase.analytics(), I get same error. "Can't find variable: IDBIndex" Support for Expo would be greatly appreciated. The has been progress with: https://firebase.google.com/support/release-notes/js#version_700_-_september_26_2019, "Added support for Analytics on web apps". Is the Node support in the roadmap? |
Same issue. I'm using Firestore, Firebase storage, Firebase Auth, but can't use analytics. |
Same issue! Sigh. Hopefully, this can be fixed. |
Same issue when importing firebase/messaging... is there a workaround or expo doesn't support cloud messaging yet? |
We are using FCM for Push Notifications (https://docs.expo.io/versions/latest/guides/using-fcm/) which does give you some Firebase Analytics (default set of events such as first_open, os_update, etc.) This only works for Android so getting the firebase-js-sdk compatible with iOS + Expo would help a lot. |
FirebaseAnalytics For Web doesn't work in non browser environments(including React native in general) because it relies on As an alternative, you can take a look at react-native-firebase - https://rnfirebase.io/ Hope it helps! |
Hi @Feiyang1 thanks for your response! Unfortunately https://rnfirebase.io/ https://github.com/invertase/react-native-firebase is not relevant for Expo projects, as it requires native iOS or Android libraries to work. I know the Expo team have made efforts in the past to integrate it, but they didn't have much success and that work is now deprecated https://blog.expo.io/using-firebase-in-expo-e13844061832 . The official advice is now to use the JS SDK, which as you know doesn't work in a non-browser environment for Analytics. Obviously I would love for this to work in my own project, but also this seems like it's affecting quite a few people. Expo is the default quickstart for React-Native https://facebook.github.io/react-native/docs/getting-started and GitHub reckons it's used in 100k projects they host https://github.com/expo/expo (which is a third of all of the 290k reported for RN https://github.com/facebook/react-native ) |
@robbie-c we were looking for a way to integrate Firebase Analytics into Expo App with SDK 33 as well. After some digging we have a solution in Expo that doesn't require any thirdparty packages. Preparations:
Android:
NOTE: Originally we did this for Expo Push Notifications (https://docs.expo.io/versions/v34.0.0/guides/using-fcm/#client-setup), so Analytics was already there iOS:
NOTE: |
Thanks, @yuzhakovvv for this - I get an issue when using this, however. My setup is const firebaseConfig = { firebase.initializeApp(firebaseConfig); export default firebase;` Then
Stack trace: What am I doing wrong, please? |
we didn’t succeed in connecting analytics in this way, the way about which @yuzhakovvv told is working for 34+ |
@VallVall i am using expo version 35, please can you inform me what i am doing wrong in the snippet? |
delete all your code with firebase just add .plist file in project and add this in app.json => check in development mode if you have any errors, then the application is assembled, analytics should work when the application starts this is works for analytics for ios for android: app.json => |
@VallVall thanks, how do you log custom events though? |
we had the task of tracking how many users are visiting the application, how we understand the files that are needed for googleServicesFile cause a function inside the native code that sends a request to the server about analytics we don't log anything |
It´s works but, how can i put the ecommerce track events o custom events. If Some one can tell me. |
Still not working in npm firebase 7.5.2 So it won't be possible to run firebase.analytics().logEvent() from Expo? |
Still not working... :( |
I'm working through the steps you outlined on 26 Nov 2019 although I'm not clear on how to complete setting this up in Firebase console. Step 3 is Add Firebase SDK and this looks geared toward React Native Can you, or anyone else who's managed to get this working, advise what I should do at this step please? |
I am running into similar problems, would be great if there were a clear solution. Thanks! |
This is not possible to use events logging from Firebase analytics when using Expo. Expo team is working on it, please refer to : https://expo.canny.io/feature-requests/p/support-for-firebase-analytics |
In case anyone finds this thread but is having issues on web. For our Gatsby SSR web app, we were able to fix this issue by doing a dynamic import of the package.
instead of
|
Who would have problem with importing it on web ? No one. The problem only comes when you use Expo. |
Server side rendering a web application will cause this problem to happen as well. We ran into it, it is how we found this thread. |
I think in 3-4 days, hope today, expo will be released. New release supports firebase/analytics. |
Hi @cemo ! It's great to hear that Firebase Analytics is coming to the new Expo SDK version :) So... I guess that explains why I have the following error if I try to use Firebase Analytics?
|
Update on this being added? |
https://blog.expo.io/expo-sdk-37-is-now-available-dd5770f066a6 :) It is released. Here is the related firebase post https://blog.expo.io/using-firebase-analytics-with-expo-222ca84e4d33 This issue can be closed. |
@NRKirby @iragsdale just skip this step |
I'm not so sure about that. Many developers are using the js based import firebase from 'firebase/app'
import 'firebase/analytics'
const app = firebase.initializeApp( {} )
app.analytics() The SDK v37 method is a great start, but people are landing here because of the I'm not sure if full js based support is desirable or on the road map at all though. |
not working on sdk 37 on testflight, localhost works though |
Update April 2020
Go read this: https://blog.expo.io/using-firebase-analytics-with-expo-222ca84e4d33
Original Post:
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
Steps to reproduce:
expo.io
Adding the JS code below to add firebase analytics does not work in expo
Adding some hacks allows it to work a bit better. (The browser polyfill because it tries to add a script tag to head, and the IndexedDB stuff because it assumes that IDBIndex exists. Some of this stuff works in debug mode in expo because the JS runs in Chrome on the host, which makes this particularly annoying to reproduce)
But when I log an analytics event I get the following error:
This is as far as I got before giving up.
This would be incredibly useful to have working. Expo is hugely popular, and https://github.com/react-community/create-react-native-app is archived and now points to expo. Right now the only way to use Firebase Analytics with react-native is to eject, which is orders of magnitude more development effort to work with that the expo managed workflow for small teams / startups.
The text was updated successfully, but these errors were encountered: