Firebase Analytics

by - 17:30


Firebase Analytics is a free app measurement solution that provides insight on app usage and user engagement

The new incredible thing Google pull from a hat. A incredible versatile library to analyze data and user engament. Would you like to try it out? Well listen here.

How to add firebase analytics to an android app

  • Enter your app's package name
  • Donwload the json file provided and insert into the "app" folder in your android project

  • Then add this inside dependencies on your root level build.gradle
  • classpath 'com.google.gms:google-services:3.0.0'

  • And this at the bottom of the app level build.gradle
  • apply plugin: 'com.google.gms.google-services'
  • Inside the same file but under "dependencies" you put this
compile 'com.google.firebase:firebase-core:9.2.1'

  • Declare a "FirebaseAnalytics" object on top of your MainActivity and the onCreate initialize it
  • mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
Now you have your basic analytics data provided by the default event. You wanna add your own? Easy.

How to add your custom event

You create a bundle and insert all the information you need the event you want to control. Take a look at the FirebaseAnalytics.Param for suggested event.
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
That's it.

You May Also Like

0 commenti