I am trying to use the expo-firebase-analytics package in the Expo Go app as a first step to making sure I have the set up correct before I see if it is working in standalone apps. However it is not working right now. Events are not being logged on my Firebase analytics console. I am following this installation guide: https://docs.expo.io/versions/latest/sdk/firebase-analytics/
I have run expo install expo-firebase-analytics. I have also run expo install firebase. I have set up a Firebase web project and added the config to my app.json.
{
"expo": {
...
"web": {
"config": {
"apiKey": "AIxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"authDomain": "my-app.firebaseapp.com",
"projectId": "my-app",
"storageBucket": "my-app.appspot.com",
"messagingSenderId": "mySenderId",
"appId": "1:myApp:web:myAppId",
"measurementId": "G-MYMEASUREMENTID"
}
},
}
Here is my App.js file
import React, { useEffect } from "react";
import { Text, View } from "react-native";
import * as Analytics from 'expo-firebase-analytics';
export default function App() {
useEffect(() => {
(async() => {
console.log("App.js useEffect");
await Analytics.logEvent('ScreenLoaded');
})();
}, []);
return <View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}><Text>MAIN SCREEN</Text></View>
}
Can anyone help me understand what I'm missing?