Firebase analytics and Ionic

Firebase analytics and Ionic
Firebase analytics and Ionic

Firebase analytics and Ionic. With ionic native it is easy to add firebase to an ionic project. In this article I am going to show you how to add firebase analytics to your ionic project. Let’s Therefore jump into some learning.


Create a folder in which you are going to save your project.

Open your favourite terminal and go to the folder you created.For instance i use iTerm terminal for most of my work.

Firstly create the ionic project. The command below creates an App.The app is called MyGoogleDevApp.

ionic start MyGoogleDevApp blank

Add firebase cordova plugin

Run the following commands to add firebase cordova plugin.

ionic cordova plugin add cordova-plugin-firebasenpm install –save @ionic-native/firebase

Add the plugins the the apps module.

Add provider to implement firebase analytics

The next step is to create a provider that will implement firebase analytics so that it is used to log events to firebase in your app.

ionic generate provider FirebaseLogger

Add the provider to the app modules, if its not already there so that you do not get errors in starting up the application. Implement the code so that you can call firebase using ionic native.

constructor(public http: Http,private firebase:Firebase) {
 console.log('Hello FirebaseLoggerProvider Provider');


After this the next step is to call the provider you created in your app in the home.ts file.

import { Component } from '@angular/core';
 import { NavController } from 'ionic-angular';
 import { FirebaseLoggerProvider } from "../../providers/firebase-logger/firebase-logger";

 selector: 'page-home',
 templateUrl: 'home.html'

 export class HomePage {
constructor(public navCtrl: NavController,private firebaselogger: FirebaseLoggerProvider) {

In conclusion this is how simple it is to add firebase analytics to your ionic mobile app. Once done it can take several hours or even a day to start seeing the logged data. Google now links Google analytics and firebase analytics to allow users to see their logged events in firebase on the Google analytics portal. In other words you can use either firebase analytics or google analytics interchangeably.

Check out how to export json data to excel in ionic angular apps


Passionate software engineer with keen interest in solving world problems using technology.He has vast experience in developing enterprise solutions from Telecommunications ,Media,Banking and Consultancy.

You May Also Like


2 thoughts on “Firebase analytics and Ionic”

  1. Long time reader, first time commenter — so, thought I’d drop a comment..
    — and at the same time ask for a favor.

    Your wordpress site is very simplistic – hope you don’t
    mind me asking what theme you’re using? (and don’t mind if
    I steal it? :P)

    I just launched my small businesses site –also built in wordpress like yours– but the theme slows
    (!) the site down quite a bit.

    In case you have a minute, you can find it
    by searching for “royal cbd” on Google (would appreciate any feedback)

    Keep up the good work– and take care of yourself during the coronavirus scare!


Leave a Reply

Your email address will not be published. Required fields are marked *