-1

I am trying to integrate firebase analytics in my Magento website. I added following code before body end tag

<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/7.11.0/firebase-app.js"></script>

<!-- TODO: Add SDKs for Firebase products that you want to use
     https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/7.11.0/firebase-analytics.js"></script>


<script>
  // Your web app's Firebase configuration
  var firebaseConfig = {
  apiKey: "api-key",
  authDomain: "project-id.firebaseapp.com",
  databaseURL: "https://project-id.firebaseio.com",
  projectId: "project-id",
  storageBucket: "project-id.appspot.com",
  messagingSenderId: "sender-id",
  appId: "app-id",
  measurementId: "G-measurement-id",
  };
  // Initialize Firebase
  firebase.initializeApp(firebaseConfig);
  firebase.analytics();
</script>

After adding this code, I get this error in google chrome console.

Uncaught ReferenceError: firebase is not defined

Any kind of help is appreciated.

UPDATE enter image description here

Sejal Shah
  • 243
  • 2
  • 11

1 Answers1

0

I tried running this code and there is other error beside firebase credentials. Is the first script loaded (it contains the part where firebase is set globaly). Check network tab that the request was ok, disable the cache before reload and check if response contains "object" == typeof self && self.self === self && void 0 !== self.firebase.