Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase analytics not showing data for web application

I want to use Firbase analytics for a web application , i added the web project in the console and copier the snippet code at the end of the body tag.

here is the snippet code :

<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/7.2.1/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.2.1/firebase-analytics.js"> 
</script>

<script>
// Your web app's Firebase configuration
var firebaseConfig = {
apiKey: "..-WY",
authDomain: "....firebaseapp.com",
databaseURL: "https://.....firebaseio.com",
projectId: "app-id",
storageBucket: "app-name.appspot.com",
messagingSenderId: "1122255",
appId: "1:22233355:web:fffff",
measurementId: "G-123J"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>

firebase is not showing any data since 3 days , what's can be wrong ?

like image 910
Anass Boukalane Avatar asked Oct 21 '19 10:10

Anass Boukalane


People also ask

How long does it take for my Firebase Analytics data to show up?

But on Android devices with Play Services, this one hour timer is across all apps using Firebase Analytics. In addition, Firebase Analytics will send down all of its data from the client if your user triggers a conversion event (like making an in-app purchase).

Can Firebase Analytics be used for websites?

Analytics users If you already have an Analytics account and you have fully provisioned your web app (added the app to a Firebase project and added the web SDK to the app), then you can use Analytics to create a new web property and web data stream.

How do I know if Firebase Analytics is working?

In the Firebase console, open your project. Select Analytics from the menu to view the Analytics reporting dashboard. The Events tab shows the event reports that are automatically created for each distinct type of event logged by your app. Read more about the Analytics reporting dashboard in the Firebase Help Center.


2 Answers

No solution, responding for further discussion.

In my case I have the web-app linked to a firebase hosted site so the configuration is set to automatic with the "reserved hosted URLs". The snippet in my case is just linking and initializing the SDK:

<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="/__/firebase/7.2.1/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="/__/firebase/7.2.1/firebase-analytics.js"></script>

<!-- Initialize Firebase -->
<script src="/__/firebase/init.js"></script>

It's been configured and deployed for around 48 hours but likewise I am not seeing any data in the firebase analytics dashboard.

I do have multiple websites per project, with their own sub-domains, but I would not expect that to cause any issues.

like image 127
roman Avatar answered Oct 13 '22 20:10

roman


You need to put this before the closing of the body tag and after firebase bootstrapping is complete.

<script> 
  firebase.analytics();
</script>
like image 21
harsimran.maan Avatar answered Oct 13 '22 19:10

harsimran.maan