By 2020, over 50% of consumer mobile interactions will be contextualized, “hyper-personal” experiences based on past behavior and current, real-time behavior.

Though it is really great to have personalized mobile interactions, mobile app developers have to have advanced tactics to track them. Firebase provides you a fascinating feature that is Firebase Analytics which is free, simple & easy to implement.

Firebase Analytics integration includes reporting for distinct events that you have defined using the Firebase Android SDK. Firebase Analytics helps you to understand how the user behaves or how the user interacts with your application. Using this you are able to track app user screens, monetize your app, analyze your business growth, user engagement, etc.

The Firebase automatically capture events and user properties and also allows you to define your own custom events to measure the things that uniquely matter to your business. Once the data is collected, it will be available in a dashboard of the Firebase console.

 Let’s start with Firebase Analytics Integration and its features. You can get more information on the Firebase Analytics Website.

Steps to Implement Firebase Analytics Integration
  • Firstly you have to open https://firebase.google.com/ and create an account on it for accessing Firebase Console.
  • Now, create a project on Firebase Console. Add package name & Register app. Download google-services.json

 

  • Create Project in Android Studio with package name used in Firebase Console project & add google-services.json file in your project’sapp. Here I have used package name as com.analytics
  • Now add Internet permission in xml file to make the network call.

<uses-permission android:name=”android.permission.INTERNET” />

  • Add firebase dependency in gradlelocated in project’s home directory

    dependencies {

            classpath ‘com.android.tools.build:gradle:2.1.2’

            classpath ‘com.google.gms:google-services:3.0.0’

        }

  • Add firebase coredependency in app/build.gradle also add apply plugin: ‘com.google.gms.google-services’

    app/build.gradle

    dependencies {

         compile ‘com.google.firebase:firebase-core:9.0.2’

    }

    apply plugin: ‘com.google.gms.google-services’

  • Now you can able to add your custom events. Please check below mention source code

    mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
    Bundle param = new Bundle();
    param.putString(“Screen_Name”, “Splash”);
    mFirebaseAnalytics.logEvent(“Splash”, param);

Output DASHBOARD

Output EVENTS

You must be thinking that Google Analytics also provides the tracking for web/app, but you can do a detailed analysis of every action that user is performing within your app with Firebase Analytics. The following table summarizes the difference between Google Analytics and Firebase Analytics:

Google Analytics

  • Pageview /Screen view data collection model
  • Limited & Pricing apply to all data which is sent to analytics from web or app
  • The Developer must initialize tracking manually using events in an app

Firebase Analytics

  • Event-based data collection model which is specially design for app
  • No fees, Unlimited Event Reporting
  • Automatically measured events like first open, in-app purchases, etc.

I hope this article helps all android app developers to integrate firebase analytics for mobile apps & would be able to track mobile app’s performance. Help their clients to enhance business productivity & return on business. If you have any queries, you can post it here.

Happy Coding!!

POSTED IN: April 10, 2017 Yogesh Jadhav