Closed snorreks closed 4 years ago
Hey @snorreks
May I ask why you are defining it as process.env.FB_MEASUREMENT_ID || ''
?
The measurement ID is used for Google Analytics on client side. Can you test if it works if you hardcode the measurement id in your nuxt.config.js like so?
measurementId: 'yourMeasurementId',
If it works then, your problem is simply that the env variable is not available on the client where Google Analytics needs the ID - so you should make sure to pass it in differently. (BTW: the Firebase config is NOT sensitive data)
PS: The measurement ID has nothing to do with Google Auth and the `firebase-auth-sw.js, we just pass the entire Firebase config to the service worker that's why it shows up there.
Yeah my bad, I fixed it now 👌
Version
@nuxtjs/firebase: 6.1.1 firebase: 7.24.0 nuxt: 2.14.7
Steps to reproduce
I have SSR enabled, and this is my Nuxt config:
What is Expected?
Get the measurement ID from the server.
What is actually happening?
The measurement ID is undefined. But when i look at the "firebase-auth-sw.js" in the static folder it has the correct measurementId.
The console: [2020-10-19T10:02:21.359Z] @firebase/analytics: The measurement ID in the local Firebase config (G-D972LYZEZX) does not match the measurement ID fetched from the server (undefined). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.