How to Track your Android App through Google Analytics

In this blog post, I would like to show how to track your Android Application using Google Analytics in Android.

Step By Steps:

  1. Go to, login, and select one of your accounts. Then, click on Admin in the navigation bar.
  2. Click on the list of properties, and choose “Create new property” under property tab.
  3. You have now to indicate that the new property will track data from a Mobile app. Give it a name, a timezone, and an industry category related to your app.
  4. Get the Tracking ID, something like  UA-xxxxxxxx-y.
  5. Download Google Analytics library .jar file from here.
  6. Add Google Analytics library to your Android project libs folder and right click, select add to build path.
  7. Update the AndroidManifest.xml file with Internet Permission.
    <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  8. Update activities code with this code snippet:
    public void onStart() {
    EasyTracker.getInstance(this).activityStart(this); // Add this method.
    public void onStop() {
    EasyTracker.getInstance(this).activityStop(this); // Add this method.
  9. Create a new xml file under values folder, analytics.xml and copy paste this code:
    <?xml version="1.0" encoding="utf-8" ?>
     <!--Replace placeholder ID with your tracking ID-->
     <string name="ga_trackingId">UA-xxxxxxxx-y</string>
     <!--Enable automatic activity tracking-->
     <bool name="ga_autoActivityTracking">true</bool>
     <!--Enable automatic exception tracking-->
     <bool name="ga_reportUncaughtExceptions">true</bool>


That’s it. Now just wait for 24 to 48 hours. and it would show all the events and analytic for the App you had registered


Hope this helpful. Your valuable comments are always welcomed. It will help to improve my post and understanding.

Download Source Code from here.

durga chiranjeevi

durga chiranjeevi

I'm currently working as Android developer at Energy Alternatives India. Interested in Application and Game development.
durga chiranjeevi

Leave a Reply

Your email address will not be published. Required fields are marked *