Can Flurry analytics provide average of integer information?
I need to integrate Flurry with Android and want to know how long (in minutes) user will be staying in main scr开发者_Python百科een. Is it possible to get such analytic using Flurry? When I checked Flurry, it gave me the statics on hit counts on a specific screen. What I want to know is the average time spent by user in main screen. Kindly help in this regard.
This can be accomplished through a timed event. Simply call one of the following methods to start the timed event. In your scenario this should be done in the onStart method of your main screen.
- logEvent(String eventId, boolean timed)
- logEvent(String eventId, Map parameters, boolean timed)
To end your timed event call
- endTimedEvent(String eventId)
In your scenario this would be called in the onStop method of your main screen. Make SURE you pass in true for the boolean timed parameter and you always match eventIds in the onStart and onStop of each Activity.
Flurry will automatically report the following metrics in your dev portal account Under Applications > Events > Your Event Id. Choose the Event Duration link or icon (a clock):
Average Event Duration - This reports the total event time divided by number of events across some period in time. For example, say you have 2 users of your app in some time period. User A views your main screen for 10 seconds, goes to a secondary screen and returns to your main screen to view for 3 seconds. User B views your main screen for 20 seconds. This is reported as (10+3+20)/3 = 11 seconds.
Event Duration Per Session - This reports the average length of time of an event per session. A session is defined as a user being within any View of your app without interruption exceeding 10 seconds (10 seconds is the default pause time and can be updated). For example, your user views the main screen for 15 seconds, goes to a secondary screen, returns to the main screen for 5 seconds. The event duration for that use case is 20 seconds for the session. This is then averaged with the other session over the same time period.
Event Duration Per User - This reports the average length of time of an event per user. A user can use your app multiple times in a given time period. For example, in a day say a user views your app 3 times (3 sessions). In the first session your user views the main page for 5 seconds, second session for 10 seconds, third session for 15 seconds. The event duration for this user is 30 seconds for the day. This is then averaged with all other users over the same time period.
I show you a simple example. In this code i want to log simple events and other events with a category.
public void logAnalyticsEvent(final String versionName, final String strMsg, final String category){
if (category==null){
FlurryAgent.logEvent(strMsg);
}else{
final HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("Event",strMsg );
FlurryAgent.logEvent(category, parameters);
}
}
in the first part of the condition i'm logging the only the event, in the second part I put the name of the event inside de parameters (a hashmap with a key named "Event" and value the name of the event) and I log the name of the category with the parameters (events inside)
FlurryAgent.logEvent(category, parameters);
Hope this helps!
I'm not sure about Flurry, but you can definitely do this using event attributes with Localytics (www.localytics.com). Simply keep track of how long the user spends on the main screen (or any activity within your application for that matter) and then record it as a bucketed event attribute to an event you fire when that activity is over.
Psuedocode example:
ActivityStart() {
long startTime = getTimeInMilliseconds();
}
ActivityClosing() {
long endTime = getTimeInMilliseconds();
}
ApplicationExitPath() {
long timeSpent = endTime - startTime;
String timeBucket = bucketizeTime(timeSpent);
Dictionary attributes = [ "Main Activity Time Spent", timeBucket];
tagEvent("App Exit", attributes);
}
String bcketizeTime(Long timeSpent) {
if(timeSpent < 1000) { return "less than 1 second"; }
if(timeSpent < 10000) { return "1 - 10 seconds"; }
if(timeSpent < 30000) { return "10 - 30 seconds"; }
...
}
精彩评论