📢 Tatvic is now India’s first certified Conversion Optimization Partner with Google

How to Setup Google Analytics Android Mobile Apps Tracking?

Last Updated:


We’re in the era of mobile, where there are 5.3 billion mobile subscribers worldwide and these numbers are increasing very rapidly. Most of the mobile subscribers are using mobile apps for either shopping or accessing social networking sites or playing games or listening to online songs and etc.

There are so many mobile apps in the market whether it’s for iPhone or Android or Blackberry or Symbian-based mobile phones or Windows OS-based smartphones.

There are so many mobile development companies or mobile developers who build mobile applications but afterward, they don’t know the effectiveness of their application in terms of how many persons actually use it after downloading, what’s bounce rate is, from which mobile handset your application is being accessed and so many factors.

For that, you should start tracking mobile applications using an analytics tool like Google Analytics. Here I’m going to explain google analytics implementation for the following mobile applications.

  1. Android
  2. iPhone

Initializing the project

To start with the tracking we first need to add the tracking SDK to the app project. The SDK is included in the latest Google Play service package.

First step – Add permissions

In order to collect data for the app, we need to add permission for accessing the Internet.

Adding the below permissions to your application’s AndroidManifest.xml manifest file would ensure that your app can send data to Google Analytics.

<uses-permission android_name=”android.permission.INTERNET” />
<uses-permission android_name=”android.permission.ACCESS_NETWORK_STATE” />

Second step – setting up a View in Google Analytics

You’ll have to set up a new profile or view in google analytics, then note down the UA number of your view which would be of the format UA-XXXXX-Y

Third step – implementation

The implementation involves adding code snippets in your app codebase at appropriate places. You can track the below activities as per your Android application :

  1. Screen View Level
  2. Event Level
  3. Custom dimension and metric
  4. E-commerce Tracking

For instance, we’ve implemented screen view level and event level tracking of google analytics for My Music Player Android app. It has 3 to 4 different tabs i.e. Albums, Artists, Songs, and Playlist. We’ve implemented screen view level implementation for tracking screen view details of different tabs/screens as with reference to the below image.

enter image description here
Creating an app tracker
// Get tracker.
    Tracker t = ((AnalyticsSampleApp) getActivity()
Screen View level implementation

Through screen view level implementation of an application, you can get an idea about unique screen views of your application’s screen like traditional apps, like unique screen view for setting section or help section.

For getting screen view level information you’ll have to implement the below standard code across all the tabs or classes or screens of your application,

// Set screen name.
// Where path is a String representing the screen name.

// Send a screen view.
t.send(new HitBuilders.AppViewBuilder().build());
Event tracking

Through event tracking implementation, you can get an idea about which actions i.e. play, pause or stop have been taken in your Android application through applying event tracking in Google Analytics.

For Instance, we’ve implemented event tracking for tracking which action has been taken in My Music Player App i.e. play or pause or stop or share it with Facebook or Twitter with reference to the below image.

For event tracking implementation, you’ll have to add the below code across the classes or functions where buttons are called

// Build and send an Event.
t.send(new HitBuilders.EventBuilder()
    .setCategory("Clicks")  // category i.e. Player Buttons
    .setAction("Button")    // action i.e.  Play
    .setLabel("clicked")    // label i.e.  any meta-data

Google Analytics Reports for Android Applications

After the implementation of the Android application successfully, you can view the analytics report for your application in your Google Analytics account. You can see the Overview Section report that includes Sessions, Screen Views, Screens/Sessions, and # of new and returning users in your application.


You can view the screen level performance of your Android application in Google Analytics with detailed information like average time on screen, unique screen views, etc in the below image.


In the next series of mobile apps tracking blog posts, I’ll be covering iPhone Application Tracking through Google Analytics. Stay tuned here for more updates on Google Analytics Implementation.

Picture of Kushan Shah

Kushan Shah

Kushan is a Web Analyst at Tatvic. His interests lie in getting maximum insights out of raw data using R and Python. He is also the maintainer of the RGoogleAnalytics library. When not analyzing data, he reads Hacker News.

Sign up for
our monthly newsletter

This field is for validation purposes and should be left unchanged.
Scroll to Top

Leverage Tatvic's comprehensive approach to 

Contact Us

This field is for validation purposes and should be left unchanged.