Google and Firebase Analytics for Mobile Apps

Mobile app reporting in Google Analytics provides insight on app usage, user engagement, and cross-network attribution. App reporting in Google Analytics is natively integrated with Firebase, Google app developer platform, to provide you with unlimited reporting for up to 500 distinct events. Mobile app reporting in Google Analytics helps you understand clearly how your users behave, which enables you to make informed decisions regarding app marketing and performance optimizations.

How does it work?

Mobile app reporting in Google Analytics helps you understand how people use your iOS or Android app. These reports work in conjunction with the Firebase SDK, which automatically captures a number of 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 captured, it’s available in a dashboard in both the Google Analytics interface and the Firebase console. This dashboard provides detailed insights about your data — from summary data such as active users and demographics to more detailed data such as identifying your most purchased items.

App reporting in Google Analytics also integrates with a number of other Firebase features. For example, it automatically logs events that correspond to your Firebase Notifications and provides reporting on the impact of each campaign. App reporting in Google Analytics includes cross-network attribution. With it, you can see the performance of your campaigns across organic and paid channels to understand which methods are most effective at driving high-value users. If you need to perform custom analysis or go deep on your custom parameters you can link your Analytics data to BigQuery – and use templates in Data Studio to visualize it.

Integrations with other services:

  • BigQuery: Link your app analytics to BigQuery where you can perform custom analysis on your entire analytics dataset and import other data sources.

  • Firebase Crash Reporting: App reporting in Google Analytics logs events for each crash so you can get a sense of the rate of crashes for different versions or regions, allowing you to gain insight into which users are impacted. You can also create audiences for users who have experienced multiple crashes and respond with Firebase Notifications directed at that audience.

  • Firebase Notifications: App reports in Google Analytics automatically log events that correspond to your Firebase Notifications and support reporting on the impact of each campaign.

  • Firebase Remote Config: Use audience definitions to change the behavior and appearance of your app for different audiences without distributing multiple versions of your app.

  • Google Tag Manager: Integrating Google Tag Manager alongside the Firebase SDK enables you to manage your analytics implementation remotely. With it, you can manage the format of your events, when they’re collected, and even route them to other destinations all from a web interface – and after your app has been distributed.

Add Google Analytics to Your Android App:

  • Add the following dependency to your project-level build.gradle:
     classpath 'com.google.gms:google-services:3.0.0'
  • Add the following dependency on Google Play Services to app/build.gradle:
    compile 'com.google.android.gms:play-services-analytics:10.2.4'

Activity or fragment:

  • Open the Activity that you’d like to track. You could also track a Fragment, but ensure that it correctly represents a screen view.
  • Override the onCreate method of the Activity or Fragment you want to track to obtain the shared Tracker instance
    // Obtain the shared Tracker instance.
    AnalyticsApplication application = (AnalyticsApplication) getApplication();
    mTracker = application.getDefaultTracker();

Add tracking code to every Activity or Fragment that represents a screen. Be sure to set a name inside every Activity or Fragment if you want to differentiate between screen views for your app in Analytics. All activity recorded on the shared tracker sends the most recent screen name until replaced or cleared (set to null).

Send an event:

To send an event, set the screen field values on the tracker, then send the hit. The following example uses the HitBuilders.EventBuilder to send an Event:

mTracker.send(new HitBuilders.EventBuilder()
    .setCategory("Action")
    .setAction("Share")
    .build());

Add Firebase Analytics to Your Android App:

  • Add the dependency for Mobile app reporting in Google Analytics to your app-level build.gradle file:
    compile ‘com.google.firebase:firebase-core:10.2.1’
  • Then initialize it in the onCreate() method
    // Obtain the FirebaseAnalytics instance.
    Firebase Analytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);

Log Events:

Once you have created a FirebaseAnalytics instance, you can use it to log either predefined or custom events with the logEvent() method. You can explore the predefined events and parameters in the FirebaseAnalytics.Event and FirebaseAnalytics.Param reference documentation. The following code logs an Event when a user clicks on a specific element in your app.

Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, id);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name);
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);

Google Analytics measures user interaction with Web, Android, and IOS Applications. It is Google’s free Android analytics service that allows you to analyze in-depth detail about the visitors on your App. It provides valuable insights that can help you to shape the success strategy of your business. At SPGON in every Web, Android and IOS application we use Google analytics.Contact Us or drop us a line at info@spgon.com


Author: Nagalakshmi Kadiyapu – Android Developer
Source: https://developers.google.com/analytics/ , https://firebase.google.com/products/analytics/