Search This Blog

Tuesday, December 13, 2011

Flurry Analytics

To start with Analytics, we need to make an account & need to do changes at code side to send events to account. Need to follow below process step by step to achieve it.

At Web side (Flurry):
1. Create an account on http://www.flurry.com/dev/signup.html
2. Add an application & select Android (for Android application developers)
3. Provide Application name & Category.
4. Now you will get a unique "application key"; this key we need to use at code level.
5. Now download the Flurry SDK for android.

At code side:
Set Environment (for Eclipse):

1. Get FlurryAgent.jar
2. Go to Properties - > Java Build Path & select Add external jar.
3. Provide the path of FlurryAgent.jar & add it.
Changes in Code:
1. Set permission in manifest file for android.permission.INTERNET
2. Start session in OnStart & End Session in onStop.
public void onStart()
{
super.onStart();
FlurryAgent.onStartSession(this, "");
}
public void onStop()
{
super.onStop();
FlurryAgent.onEndSession(this);
}

After this your application will be linked to Flurry account.
Now to trace various Events & to get Page Counts, use API set of FlurryAgent at required place at code level & you will get complete details in your web Flurry account.

Import APIs:
To Trace Events:
FlurryAgent.logEvent (String eventId)
FlurryAgent.logEvent (String eventId, boolean timed)
FlurryAgent.logEvent (String eventId, Map parameters)
FlurryAgent.logEvent (String eventId, Map parameters, boolean timed)

e.g.
final HashMap parameters = new HashMap();
parameters.put("Event","myEventName");
FlurryAgent.logEvent("EVENT_ID", parameters);

To Trace Page Views:
FlurryAgent.onPageView();

Useful Link: https://dev.flurry.com/android_uploadNewVersion.do?projectID=135549