Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 380
Sagar Ranglani Avatar asked May 19 '16 18:05

Sagar Ranglani


People also ask

How do you integrate Firebase Analytics in ionic?

Firebase Project Setup If you already got a project, you can also manually enable GA by going to Project settings -> Integration – > Google Analytics within your existing Firebase project! The next step is to add a web, iOS and Android application inside Firebase.

Does Firebase work with ionic?

Ionic developers can use Firebase to build rich features into their mobile apps and to monitor and improve app quality over time.


3 Answers

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

like image 166
GreenDome Avatar answered Oct 19 '22 14:10

GreenDome


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));
like image 22
pwagner Avatar answered Oct 19 '22 14:10

pwagner


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.

like image 2
0x1ad2 Avatar answered Oct 19 '22 12:10

0x1ad2