Guide to Add User Tracking & Advanced Analytics in Your iOS and Android Apps

commas-left

Have you ever thought to have analytics in your app?

Are you aware of all possible analytics SDKs for mobile apps?

Let's go through all of them and explore strength of each provider.

commas-right

mobile app startup

Why Analytics is Needed in Your app?

When you are building a mobile app for your enterprise or business, then it becomes ideal for you to have analytics added in your app.

If you wish to go for a series of fundings, then the investors mainly consider the future potential of the app from its daily active users, user’s interest and retainment in the app.

With analytics in your app, you can see DAU (daily active users) and MAU (monthly active users), average time spent in the app and much more. There are 3 industry leading analytics companies for mobile apps which we are going to cover in this blog. These are as follows:

Basics of analytics start with screen tracking and below are the most features you should have in your app.

We are also mentioning some code snippets and links so you as a startup founder have an idea about the engineering implementation and estimation that will help you gain knowledge and talk to the right developers.

1) Screen Tracking

Screen tracking covers all views of app and this helps identify which are the screens mostly visited on a daily basis.

This helps you gain retainment of user and check user interest in particular screen. Also, this helps you in creating a more awesome user experience (UX) or functionality.

Development Time: ( number_of_screens * 2 mins )

Google Analytics iOS implementation

If you are using Google Analytics in iOS then just put a few lines of code in each screen and start tracking. First use pods to install dependency

1
2
pod 'Google/Analytics'
pod install

Now put in each screen this code and don’t forget to import library#import

1
2
3
4
5
id tracker = [[GAI sharedInstance] defaultTracker];
//Specify your app screen name.
[tracker set:kGAIScreenName
       value:@"Dashboard Screen"];
[tracker send:[[GAIDictionaryBuilder createScreenView] build]];

Google Analytics Android Setup

Clone to Android Studio:

1
$ git clone https://github.com/googlesamples/google-services.git

Similarly, you can add screen tracking with few lines of code as given here.

MixPanel implementation can be found here.

Flurry implementation can be found here.

2) User Tracking

This is the most important and demanding feature for the startup companies, i.e. to identify particular user’s activities in the app. If you are using Google then it can be done with UserID field and MixPanel is the one which gives detailed user tracking.

Not all apis will allow you user tracking other than we are discussing here, it is also referred in cohort based analysis.

Now let’s see how you can achieve it in Google Analytics, MixPanel and Flurry.

Google Analytics

You can use UserID field to track user, see more reference here.

MixPanel

iOS Code

First, install library dependency with cocoa pods.

1
2
pod 'Mixpanel'
pod install

Second, import library file in AppDelegate and controller you want to put tracking.

1
#import "Mixpanel.h"

Add these two lines in didFinishLaunchWithOptions method.

1
2
[Mixpanel sharedInstanceWithToken:MIXPANEL_API_KEY_OR_TOKEN];
Mixpanel mixpanel = [Mixpanel sharedInstance];

For Tracking just add below line in ViewController’s viewWillAppear method or any button click.

1
2
[mixpanel track:@"Login_Propery" properties:@{@"Username": @"Jose Alfred"
                                                  }];

Android Code

First, update gradle to add mixpanl library dependency

1
2
3
4
5
6
7
8
9
10
11
12
compile "com.mixpanel.android:mixpanel-android:4.8.0"
    compile "com.google.android.gms:play-services:3.1+"}android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.mixpanel.example.myapplication"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }}

Second, you need to provide necessary permissions in your app’s manifest.xml

1
2
3
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />

Third, import in your java file

1
import com.mixpanel.android.mpmetrics.MixpanelAPI;

Then put tracking code.

1
2
3
4
JSONObject props = new JSONObject();
props.put("Username", "Jose Alfred");
props.put("Login", true);
mixpanel.track("Login Activity", props);

Just repeat steps in all controllers you wish to track. Then, you are done!

Flurry

You can simply get started with flurry as like above process, just refer developer doc.

Development Time: ( number_of_Events * 2 mins )

3) Event Tracking

Buttons usually are considered as events, we can have other interactions also but it depends on the app.

If you want to track which are the events people use the most then Event Tracking helps you.

Development Time: ( number_of_Events * 2 mins )

Google Analytics iOS implementation

1
2
3
4
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"action"
                                                      action:@"buttontouch"
                                                       label:@"buy"
                                                       value:nil] build]];

4) Demographics

Analytics gives you data by population and age segmented for countries, regions and cities.

Implementation can be found in documentations provided above for all 3 analytics apis.

5) Custom Search

This helps, when you want to know how many users do search particular “keyword” or which “keyword” in your site is searched often.

This is often needed for an app which allows user to search something.

6) By Devices

Analytics completes your need by allowing you data of how many users of your app using iPhone 5, iPhone 6, Samsung Note 3 etc. This helps you understand manufactures and various devices you app should be compatible with.

7) Network Data

These APIs are reach to provide you the operator information for the users in your app. It’s not necessary that all startups want reports of user using operators but if you have an app that deals with downloading videos and photos then network data provides you good statistic.

8) OS Version Wise

Provides your information on which OS versions are your user using the most.

Now, let’s see how these three analytics are different from each other and helps you decide to select the best of them based on your app’s requirement.

Advanced Analytics in Your mobile

Do I Need it for My App?

We say yes, if you want to promote your app in more countries. Without statistical data you should not invest in an app and it’s unlikely that the app would get pitched to investors.

Conclusion

In this article, we have explored 3 analytics providers and now you understand strength of each. Now, you should be able to select one of the most suitable analytics for your app. We don’t endorse or dislike any particular analytics solution. When helping a business implement an analytics solution, we consider the unique needs of each business we work with, and we integrate the solution seamlessly.

There are many other features these analytics provide which depend on the app use cases, features & target audience.

We have gathered in-depth research on Google Analytics, Mixpanel, and Flurry, and our mobile developers are updated on regular basis as and when new feature is added.

Whether you have existing app or app from the scratch, we definitely love to work with good companies.

trackback

  1. Data Analysis is as important as App marketing. Data analysis shows where and what we lack and where we stand out from others.
    There are number of tracking tools available that can help to accomplish the task.
    Thanks for sharing the knowledge.

Leave a Reply

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

CAPTCHA

*