Tracking User Activity In Android App using App42 Analytics

App42 analytic feature enables the app developer to analyze user behavior and to take informed business decision on top of that.  App42 Analytics feature is equipped with event API using which one can do the following app analysis:
  1. Which view/page is being viewed more in the app
  2. How much  time user is spending on different app views.
  3. Which view/page user has not seen yet.
  4. Which button is being clicked maximum/minimum to track Call To Action (CTA)
  5. How user is navigating between different app views.
  6. Funnel Management based on user activity/event

This blog demonstrates how one  can capture user activity in the Android app using App42  analytics feature which includes page/activity view and total time spent on a particular activity. We have created an Android sample app to demonstrate this and here are the steps to build and run this application.

  1. Register with App42 platform.
  2. Create an app once you are on Quick start page after registration.
  3. If you are already registered, login to AppHQ  console and create an app from Create App button under App Manager Tab.
  4. Fill all the mandatory fields and get your APIKey and SecretKey.
  5. Download App42 Android sample app and unzip it on your machine .
  6. Open this Sample App in your eclipse IDE.
  7. Open the Constants.java in src of the package(app42Sample) and put your APIKey and SecretKey (which were received in step#2 or #3).
  8. Build and Run Sample App.
  9. This will open up login cum registration screen. Your app user needs to either login or register if using it for the first time.
  10. Once user is logged in, he will be taken to MainActivity page, click on Next button on this page and user will be navigated to SecondActivity. Similarly, from SecondActivity user will be navigated to ThirdActivity screen.
  11. Go to AppHQ Console , click on User Activity Tab on dashboard and you should be able to see complete track of user activity. This will show you how much time (in second) was spent by your app user on each activity in the tabular view as well as which activity is being viewed more in the pie chart.
useractivity 1024x497 Tracking User Activity In Android App using App42 Analytics
Design Details
Sample app uses App42 analytics event API to track the user activity. Every Activity in the sample app overrides App42Activity class. App42Activity class puts the event on App42 server whenever any activity gets opened or closed along with respective activity name. App42Activity overrides onResume method to log the activity open event on server by passing event name as “Landed
1
2
3
4
5
6
7
8
9
10
11
public void onResume() {
       super.onResume();
	App42API.buildLogService().setEvent(this.getClass().getName(), "Landed", new App42CallBack() {
			public void onSuccess(Object arg0) {
				// TODO Auto-generated method stub
			}
			public void onException(Exception arg0) {
				// TODO Auto-generated method stub
			}
		});
   }

Similarly, it overrides onPause method of Android Activity  by passing event “Escaped” in the event API as shown below.

1
2
3
4
5
6
7
8
9
10
11
public void onPause() {
       super.onPause();
	App42API.buildLogService().setEvent(this.getClass().getName(), "Escaped", new App42CallBack() {
			public void onSuccess(Object arg0) {
				// TODO Auto-generated method stub
			}
			public void onException(Exception arg0) {
				// TODO Auto-generated method stub
			}
		});
   }
As a developer you have to just put App42 Android jar in your project and extend your Activity with App42Activity instead of Activity class of Android and you should be able to see your user activity trace as described above.
If you have any questions or need any further assistance, please feel free to write us at support@shephertz.com
twitter Tracking User Activity In Android App using App42 Analyticsfacebook Tracking User Activity In Android App using App42 Analyticsgoogle Tracking User Activity In Android App using App42 Analyticslinkedin Tracking User Activity In Android App using App42 Analyticspinterest Tracking User Activity In Android App using App42 Analyticsreddit Tracking User Activity In Android App using App42 Analyticsstumbleupon Tracking User Activity In Android App using App42 Analyticstumblr Tracking User Activity In Android App using App42 Analytics

Leave a Reply

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


nine × 5 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>