Thursday, January 30, 2014

Integrate Google analytics in Android

1. Why Analytics in Mobile app ?

Analytics is one of the major parts in applications that drive revenue.  Mobile App Analytics help you set and track the goal conversions you want most: purchases, clicks, or simply time spent on your app. It is required to make business inclined towards user’s interest. For example, if you developing an application for Mobile Shopper app, it is important to track the below things.
  1. Number of users/active users from across the world
  2. Most viewed products, categories, brands, etc.
  3. Number of users placing request, etc.
The above information is required in order to improve the product and make the service is better.

2. Introduction to Google Analytics

The Google Analytics Platform lets you measure user interactions with your business across various devices and environments. The platform provides all the computing resources to collect, store, process, and report on these user-interactions.

3. Supported Features

Below are the currently supported features. Read more
  1. Google Play Integration
  2. Crash and Exception Reporting
  3. Custom Reports
  4. Event Tracking
  5. Flow Visualization
  6. Real-Time Reporting

4. How to use Google Analytics in android

This section of tutorial we will see detailed steps to install Google Analytics for your android application. Before begin with Analytics integration we need the following items
  1. Android developer SDK and required configurations. I assume you have it already, if not you can follow Android official documentation
  2. Google Analytics SDK for Android v3, with libGoogleAnalyticsServices.jar file. Copy this file in your project’s /libs directory.
  3. Codebase of an Android app that you like to implement the Google Analytics
  4. Create a Google Analytics account (Requires Gmail), and then create a new app property and view in the Analytics console.
create xml file in values folders inside resource folder  (Analytics.xml  )

<?xml version="1.0" encoding="utf-8"?>
    <!-- Replace placeholder ID with your tracking ID -->
    <string name="ga_trackingId">UA-xxxx</string>
    <!-- Enable automatic activity tracking -->
    <bool name="ga_autoActivityTracking">true</bool>
    <!-- Enable automatic exception tracking -->
    <bool name="ga_reportUncaughtExceptions">true</bool>   

register this activity in manifest.xml 

            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

In activity place this code for display ads and Implement AdListener to current activity

this.interstitialAds = new InterstitialAd(this,Constants.unitID);

No comments:

Post a Comment