0

I have tried different work around, but I am unable to do Firebase analytics in ionic 3. Please anyone help me from scratch on Firebase analytics from ionic 3.

KENdi
  • 7,576
  • 2
  • 16
  • 31
  • What SDK/library are you using to use Firebase in Ionic. If you're using the raw JavaScript SDK, you won't be able to use Firebase Analytics, as there is no support for it in that SDK. See https://stackoverflow.com/questions/37325871/firebase-analytics-for-web-apps-after-firebase-expansion – Frank van Puffelen Feb 07 '19 at 03:24

2 Answers2

0

first add the firebase analytics to your project:

ionic cordova plugin add cordova-plugin-firebase-analytics
npm install @ionic-native/firebase-analytics

then create the event you want to log:

import { FirebaseAnalytics } from '@ionic-native/firebase-analytics';


constructor(private firebaseAnalytics: FirebaseAnalytics){
  this.firebaseAnalytics.logEvent('custom_event',{param: 'my_param'
}

and finally add the custom_event and the param to your analytics dashboard to see it (it takes few hours for it to appear)

0

For Ionic3: the correct commands are

ionic cordova plugin add cordova-plugin-firebase-analytics
npm install --save @ionic-native/firebase-analytics@4

See also this helpful blog post : here

GraSim
  • 3,830
  • 1
  • 29
  • 35