简体   繁体   中英

Integrating firebase analytics to just see how many users visit my webpage

I am hosting my webpage on firebase hosting and I have added my project to firebase analytics. I followed through the documentation and I added the scripts on my index page in the bottom:

<script src="/__/firebase/7.2.1/firebase-app.js"></script>
<script src="/__/firebase/7.2.1/firebase-analytics.js"></script>
<script src="/__/firebase/init.js"></script>

And then I added these inititialized firebase and called the analytics function

firebase.initializeApp();
firebase.analytics();

When I load the webpage it gives me an error analytics() is not a function. How do I just call the firebase analytics so I get the user data for my website?

I got to resolve the issue. The problem was with loading firebase from Reserved Hosting URL's. Instead I used firebase from CDN and added configure parameters manually and it worked for me.

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