简体   繁体   中英

WebConfig doesn't return measurementId

I am trying to enable firebase analytics in my existing firebase project. The project is a static React website that only uses Firebase hosting.

Following this get start tutorial, I am getting the following error in my console:

Ignored "config" command. Invalid arguments found

Searching how to solve this problem, I found this comment and checked that my webConfig get request is not returning the measurementId. However I couldn't find any info about how to correct it.

//firebase.js
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import { getAnalytics} from "firebase/analytics";

// Your web app's Firebase configuration
const firebaseConfig = {
  apiKey: "{ApiKey}",
  authDomain: "{projectId}.firebaseapp.com",
  projectId: "{projectId}",
  storageBucket: "{projectId}.appspot.com",
  messagingSenderId: "{messagingSenderId}",
  appId: "{appId}",
  measurementId: "{measurementId}",
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);

export const analytics = getAnalytics(app);

WebConfig call (Http 200, Get):

response:

{
  "projectId": "{projectId}",
  "appId": "{appId}",
  "storageBucket": "{projectId}.appspot.com",
  "authDomain": "{projectId}.firebaseapp.com",
  "messagingSenderId":  "{messagingSenderId}"
}

Is there any config that I am missing? what should I do to make it work?

There could be something wrong with the stream for your web app that's why the measurementId is not being configured. You could try to unlink and relink to your Google Analytics integration which usually resolves any broken integration. Make sure that the currently linked GA property is the one you're going to use for relinking to avoid losing your data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM