Setup Firebase Analytics for Nuxt.js

Install

npm i nuxtnpm i firebasenpm i @nuxtjs/firebase

Edit nuxt.config.js

export default {  modules: [    '@nuxtjs/firebase',  ],  firebase: {    config: {      apiKey: '<apiKey>',      authDomain: '<authDomain>',      databaseURL: '<databaseURL>',      projectId: '<projectId>',      storageBucket: '<storageBucket>',      messagingSenderId: '<messagingSenderId>',      appId: '<appId>',      measurementId: '<measurementId>'    },    services: {      analytics: true    }  }}

NOTE: To get config, goto Firebase Console -> Project -> Project settings (click Gear icon beside Project Overview), click Add app if you haven't done so, else Your apps -> Firebase SDK snippet -> Config.

The above configuration is will automatically track number of users and pageviews without additional setup required.

View Report

If you link your Firebase project with Google Analytics, you can view the report at Google Analytics as well

References:

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.