Sagar Ranglani
Sagar Ranglani

Reputation: 5691

How to integrate "Google Firebase Analytics" in ionic apps?

In the official Firebase Integration Guide (Android) and Firebase Integration Guide (iOS), they have provided individual integration guidelines.

Could you please tell me an ionic way I can integrate Firebase Analytics into ionic apps?

I need to do this as AdMob made the Firebase Analytics as its recommendation analytics solution for mobile apps.

Thank you in advance.

Upvotes: 17

Views: 11504

Answers (3)

pwagner
pwagner

Reputation: 1244

In the meantime, an Ionic Native plugin on top of the Cordova plugin cordova-plugin-firebase-analytics has been released: https://ionicframework.com/docs/native/firebase-analytics/

It's still in beta, but I had no problems with it so far (except for a conflict with phonegap-plugin-push). The integration is very straight forward:

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

constructor(private firebaseAnalytics: FirebaseAnalytics) { ... }

To track an event just call logEvent:

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

Upvotes: 3

0x1ad2
0x1ad2

Reputation: 8062

Looks like someone created a repository for Firebase in Cordova, you should be able to use that. It says that it will give you at least push notifications, analytics, event tracking, crash reporting.

Upvotes: 2

GreenDome
GreenDome

Reputation: 277

Worth keeping any eye on this thread: https://groups.google.com/forum/#!topic/firebase-talk/MKfIzAtNNuA

Upvotes: 3

Related Questions