Skip to main content
Version: v6

Firebase Analytics

Cordova plugin for Firebase Analytics

Go to firebase console and export google-services.json and GoogleService-Info.plist. Put those files into the root of your cordova app folder.

NOTE: on iOS in order to collect demographic, age, gender data etc. you should additionally include AdSupport.framework into your project.

Using capacitor?

For Android you'll have to add in android/app/src/main/AndroidManfiest.xml under <application>

<meta-data
tools:replace="android:value"
android:name="firebase_analytics_collection_enabled"
android:value="true"/>

<meta-data
tools:replace="android:value"
android:name="google_analytics_automatic_screen_reporting_enabled"
android:value="false"/>

And in the same file, you'll have to add xmlns:tools="http://schemas.android.com/tools" to your manifest tag.

https://github.com/chemerisuk/cordova-plugin-firebase-analytics

Stuck on a Cordova issue?

Don't waste precious time on plugin issues.

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.

Installation

$ npm install cordova-plugin-firebase-analytics 
$ npm install @awesome-cordova-plugins/firebase-analytics
$ ionic cap sync

Supported Platforms

  • Android
  • iOS

Usage

React

Learn more about using Ionic Native components in React

Angular

import { FirebaseAnalytics } from '@awesome-cordova-plugins/firebase-analytics/ngx';


constructor(private firebaseAnalytics: FirebaseAnalytics) { }

...

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