Getting error in firebase-analytics plugin using ionic 3

Hi everyone,

I am using firebase-analytics plugin in my ionic 3 app, which I installed following this link:


Now, when I try to fire a custom event using this:

this.firebaseAnalytics.logEvent('page_view', {page: "dashboard"})
  .then((res: any) => console.log(res))
  .catch((error: any) => console.error(error));

I am getting an error as:

ERROR Error: Uncaught (in promise): TypeError: Object(...) is not a function
TypeError: Object(...) is not a function
    at FirebaseAnalytics.logEvent (vendor.js:102827)
    at MyApp.webpackJsonp.853.MyApp.registerFA (main.js:8375)
    at main.js:8239
    at t.invoke (polyfills.js:3)
    at Object.onInvoke (vendor.js:4509)
    at t.invoke (polyfills.js:3)
    at r.run (polyfills.js:3)
    at polyfills.js:3
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (vendor.js:4500)
    at FirebaseAnalytics.logEvent (vendor.js:102827)
    at MyApp.webpackJsonp.853.MyApp.registerFA (main.js:8375)
    at main.js:8239
    at t.invoke (polyfills.js:3)
    at Object.onInvoke (vendor.js:4509)
    at t.invoke (polyfills.js:3)
    at r.run (polyfills.js:3)
    at polyfills.js:3
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (vendor.js:4500)
    at c (polyfills.js:3)
    at polyfills.js:3
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (vendor.js:4500)
    at t.invokeTask (polyfills.js:3)
    at r.runTask (polyfills.js:3)
    at o (polyfills.js:3)

I don’t know what is the problem as no custom methods like setCurrentScreen() , setUserId()etc aren’t working.
But all the automatic tracking events like “user_engagement”, “screen_view”, etc which are fired by firebase analytics by default are working properly (I even saw them in my firebase console).

Please help :slight_smile:

Did you solve the problem?

Hi @sebafra,

Yes, I was able to solve the problem.

View this link if you want a better idea:

(Don’t forget to like this answer if it solves your problem, like it on github too, so that people will get to know the solution easily.)

Thanks for your answer. I don’t have any error at all. I can’t see logs in Firebase console.
All seems to be ok. But nothing happens.
Thanks