Firebase and Google Analytics - missing measurementId? - firebase

I have a few Firebase projects on which I use Firestore and Firebase Storage.
I want to start using Google Analytics and I see this page with all the instructions. The key setting being the parameter "measurementId".
So, following the instructions, I go to my project settings and find the config snippet but unlike in the instructions it does NOT contain this parameter...
How do I generate it?

The solution came from Firebase support, my project needed to be "relinked" to Google Analytics.
Relink your Firebase project to a Mobile App property
If you had
previously linked your Firebase project with your Analytics account
but are no longer able to locate your Firebase project in Analytics:
Open your Firebase project.
Open Project settings > Integrations.
Click the Analytics card to link Analytics to your project.
More details here

I experienced this also. It seems there is a bug in the website. Set up Firebase CLI and run the following command.
firebase --project <project-name> apps:sdkconfig
It should output something like the following:
? Select the app to get the configuration data: Web - 1:686396208177:web:5119a766dc890b7d671110 (WEB)
✔ Downloading configuration data of your Firebase WEB app
// Copy and paste this into your JavaScript code to initialize the Firebase SDK.
// You will also need to load the Firebase SDK.
// See https://firebase.google.com/docs/web/setup for more details.
firebase.initializeApp({
// ... snip ...
"measurementId": "redacted"
});
It includes measurementId.

Related

firestore is not working with React Native Expo

I installed firebase with react native expo using expo add firebase, then
I created a file (firebase.tsx) and added the Firebase configuration and initialized the app like in this screenshot with correct values].
I have added the google-services.json and
GoogleService-info.plist to the root of my expo project like the documentation say and i am importing firebase in my api service like this import Firebase from './../../../firebase'.
In my register function I call the firebase create user function
const response = await Firebase.auth().createUserWithEmailAndPassword(values.email.value, values.password.value)
The response is never returned, and if I use . then nothing happens either.
If I log firebase.auth I get an object with my API key and app name, etc. so Firebase is installed, but whenever I call the database for sign in or to access a collection nothing happens.
This is my package.json.
This is my app.json.
I added bundleIdentifier and googleServicesFile to iOS and package and googleServicesFile for Android.
currently Firebase seems not to be working in expo if you are using the android configuration. I have tried the web configuration and it has worked for me. Here is the youtube tutorial for it. Watch from 38:20 to set up.

FirebaseError: Analytics: "measurementId" field is empty in Firebase config

I cannot start project with yarn run dev and have this error:
FirebaseError: Analytics: "measurementId" field is empty in Firebase config. Firebase Analytics requires this field to contain a valid measurement ID. (analytics/no-ga-id).
I deleted yarn.lock file, added some extra variables to.env file. Where can I find measurementId? What might help in this kind of error? May be somebody have already faced with such problem. Thanks :)
This has nothing to do with your yarn lock file. Which client side sdk are you using for Firebase? Angularfire perhaps?
I assume you did put your firebase config in your environment file of your angular app. Just add the property "measurementId" to it with the correct value, and you are good to go. You can get this property in your Firebase project.
If your app uses the Firebase hosting and uses reserved URLs you are good to go since it automatically handles the configuration for your application. It seems it isn't your case.
You should add or update the config file to ensure the measurementId field is present. To find the config file go to Your apps card in your Project settings from the Firebase Console.
It can be useful as well: How to get the measurementId from the Firebase config?

How does one upload the dSYM via fastlane to Firebase Crashlytics

Does anyone know how one uploads the dSYM via fastlane to Firebase Crashlytics
There is documentation here https://docs.fastlane.tools/actions/crashlytics/#crashlytics
But I am unaware of where to get the apiToken, and this seems to be more Crashlytics without Firebase focussed
Thanks
The crashlytics fastlane action uploads builds to Fabric's Crashlytics Beta, which is used for beta testing apps.
It sounds like you're actually looking for the upload_symbols_to_crashlytics action to upload dSYMs to Firebase Crashlytics.
Using the upload_symbols_to_crashlytics action you can specify the GoogleService-Info.plist (gsp_path) path and that should work.
You can find the API token in your organization's settings page but you must be an admin to view it.
Documentation - https://docs.fabric.io/android/fabric/settings/api-keys.html
Link to organizations page - https://www.fabric.io/settings/organizations

Unlink an existing firebase app?

I want to "Link to new or existing Firebase project & app"
but the crashlytics dashboard told me my project is already linked,
how to unlink my existing project ?
To unlink your Fabric app from Firebase, follow the following steps:
Go to The Firebase project settings
Go to Integrations
Select the Fabric "Manage" link
Click the "Unlink Fabric App"
Very late but if someone still having this problem:
1- try to unlink on firebase dashboard as explanined in this response: https://stackoverflow.com/a/49229545/5679560
2- if the option to remove fabric doesn't appear use this direct link
https://fabric.io/remove_firebase_crashlytics?clientId=CLIENT_ID&projectId=PROJECT_ID
CLIENT_ID is your Firebase Client ID. This begins with "android:" or "ios:" and is followed by either your package name (Android) or bundle ID (iOS)
PROJECT_ID is your app’s containing Firebase project ID, which can be found by going to Project Settings. This is also present in the URL of your Firebase console, i.e. https://console.firebase.google.com/project/
you can check more info in this answer https://stackoverflow.com/a/50003432/5679560

Where can I find the API KEY for Firebase Cloud Messaging?

I am trying to figure out how the new version of GCM or Firebase Cloud Messaging works so I moved one of my projects to the new Firebase console, If I did not have the API KEY or I want to create a new one... where can I do it?
It's in https://console.firebase.google.com/project/(your-project-id)/settings/cloudmessaging
You can find the API KEY in:
(gear-next-to-project-name) > Project Settings > Cloud Messaging
Server Key is the API key.
STEP 1: Go to Firebase Console
STEP 2: Select your Project
STEP 3: Click on Settings icon and select Project Settings
STEP 4: Select CLOUD MESSAGING tab
You can open the project in the firebase, then you should click on the project overview, then goto project settings you will see the web API Key there.
Enter here:
https: //console.firebase.google.com/project/your-project-name/overview
(replace your-project with your project-name)
and click in "Add firebase in your web app"(the red circle icon) this action show you a dialog with:
apiKey
authDomain
databaseURL
storageBucket
messagingSenderId
1.Create a Firebase project in the Firebase console, if you don't already have one. If you already have an existing Google project associated with your app, click Import Google Project. Otherwise, click Create New Project.
2.Click settings and select Permissions.
3.Select Service accounts from the menu on the left.
4.Click Create service account.
Enter a name for your service account.
You can optionally customize the ID from the one automatically generated from the name.
Select Furnish a new private key and leave the Key type as JSON.
Leave Enable Google Apps Domain-wide Delegation unselected.
Click Create.
This might be what you're looking for. This was in the tutorial on the site
Please add new api key from Firebase -> Project Settings -> Cloud Messaging -> Legacy Server Key to the workspace file i.e google-services.json
You can find API KEY from the google-services.json file
Click on Project Overview -> Project Settings,
Then click on Cloud Messaging,
Then click on three dots to the right side of Cloud Messaging Api(Legacy) and enable it,click on, to view image
4. Come back to Project Overview -> Project Settings -> Cloud Messaging, here you will get the Server Key
If you want to get the current api key programmatically in android studio, use
FirebaseOptions.fromResource(context).getApiKey()
Click on Project Overview -> Project Settings
Copy your web api key
Once you just go to autherization section it will generate and also make sure enable legacy if need
Web api key is not generated in firebase while creating a new project as stated on the documentation
You can also get the API key in the android studio. Switch to Project view in android
then find the google-services.json. Scroll down and you will find the api_key

Resources