Skip to content

Commit a939d4c

Browse files
committed
fix(analytics): disable Firebase Analytics to prevent conflict with direct Google Analytics
- Disable Firebase Analytics initialization to prevent console errors - Remove unused Firebase Analytics import - Use direct Google Analytics via GoogleAnalytics component instead - Fixes production error: Failed to fetch Firebase app's measurement ID - Firebase Auth and Firestore continue to work normally
1 parent ffabbee commit a939d4c

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lib/firebase/firebase.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import { initializeApp, getApps, FirebaseApp } from 'firebase/app';
33
import { getFirestore, connectFirestoreEmulator, Firestore } from 'firebase/firestore';
44
import { getAuth, connectAuthEmulator, Auth } from 'firebase/auth';
5-
import { getAnalytics, isSupported } from 'firebase/analytics';
5+
// Firebase Analytics is disabled - we use direct Google Analytics instead
6+
// import { getAnalytics, isSupported } from 'firebase/analytics';
67

78
// Get Firebase configuration from environment variables
89
function getFirebaseConfig() {
@@ -100,10 +101,13 @@ if (
100101
}
101102

102103
// Initialize Analytics
103-
if (typeof window !== 'undefined' && app) {
104-
isSupported().then(supported => {
105-
if (supported) {
106-
getAnalytics(app);
107-
}
108-
});
109-
}
104+
// NOTE: Firebase Analytics is disabled - we use direct Google Analytics instead
105+
// via the GoogleAnalytics component in app/layout.tsx
106+
// Uncomment below if you want to use Firebase Analytics instead:
107+
// if (typeof window !== 'undefined' && app) {
108+
// isSupported().then(supported => {
109+
// if (supported) {
110+
// getAnalytics(app);
111+
// }
112+
// });
113+
// }

0 commit comments

Comments
 (0)