January 22, 2010

New Feature Explored: Event Tracking & Attributes

Share

We are happy to announce the availability of new client libraries for Android, Blackberry and iPhone apps that support performance improvements and a number of new features. One feature I particularly want to highlight is Event Attributes. Developers have always been able to record events in their applications, but now in addition to recording events you can record attributes associated with the event.

This feature significantly expands an app developers ability to track user behavior. For example, a game developer might track metrics for each level, such as how many lives a user has left or how long it takes to complete the level. Others might use it to refine their advertising strategy, tracking ad fill rates, click through rates and even what users were doing when they clicked an ad. Of course, like all Localytics charts, event attribute data are collected and reported in real-time.

Application Usage Example

To provide an example of how Event Attributes can help you, I implemented this feature in our new demo application, GPS Walk and Run Tracker. This demo app helps users track time spent and distance covered while exercising. The app uses Localytics to record usage data, such as how many trips users take, and marketing metrics such as the success of the in-app advertising.

A key customer usage insight for this app is whether it’s being used by runners or walkers, which we can leverage to market it more effectively and focus on the right potential sponsors and advertisers. Therefore, I configured Localytics to track the maximum speed users traveled during their trip as part of an event I called “Trip Completed”.

The resulting analytics show that a significant majority of our users are walkers, and accordingly I can focus product development and marketing efforts on this segment.

Android analytics event tracking report

To determine users’ speed and distance, GPS Walk and Run Tracker relies on a device’s built-in GPS receiver and its accuracy is dependent upon the quality of the GPS signal. In order to measure how the GPS signal might impact user experience, the application also tracks GPS accuracy as part of the “Trip Completed” event. This way, when a user is done with their trip I can know how accurate their trip was.

Android analytics event attribute tracking report

This chart shows that almost half the users experience accuracy within 10 meters, which is sufficient for this application’s purposes. However, we also see that nearly a quarter of users do not have a good GPS fix and as a result will experience degraded performance. This helped explain some of the lower ratings for this app.

Advertising Metrics Example

While Event Attributes are often used to profile how users interact with an app, you can also use this feature to collect relevant data related on other events, for example, in-app advertising.

GPS Walk and Run Tracker display ads and we used the same Event Attributes feature to determine what a user was doing when he/she clicked an ad. This is a powerful set of information that is not easily collected by other means. I also instrumented our demo app to capture how quickly the user was moving when he/she clicked on the ad. Not too surprisingly, users clicking on an ad tended to be stationary. With these data, I might redesign the app to avoid showing ads when the user is moving quickly and use that screen real estate for something more valuable.

Android analytics event tracking report

Implementation

So how to make use of this feature? Tagging an event in your app is done with a single Localytics API call:

mySession.tagEvent("Ad was clicked");

To extend that with Event Attributes, simply pass along a second parameter containing a dictionary or mapping of your keys and values. For example, above we showed the application termination event. Here is the code that is being used to generate that data:

static final String ADS_PER_SESSION_NAME = "Ads served per session";
static final String TRIPS_PER_SESSION_NAME = "Number of trips per session";
static final String APP_EXIT_NAME = "Application terminated";

Map values = new HashMap ();
values.put(ADS_PER_SESSION_NAME, this.numAds > 3 ? "more than 3" : String.valueOf(this.numAds));
values.put(TRIPS_PER_SESSION_NAME, String.valueOf(this.numTrips));
this.localyticsSession.tagEvent(APP_EXIT_NAME, values);
You can also upload different attributes based on conditions inside your app. Imagine you had were tracking an event which could fail. It would be helpful to record information about the event when it succeeds, or the error code in the case of a failure. This way you can get the failure rate, learn what errors people are most commonly seeing, and track information about your event with a single Localytics call. See this example where a high score is uploaded to a server, and if the score succeeds we record the level, if it fails we record the error:
static final String ATTR_ERROR_MSG_NAME = "Error message";
static final String ATTR_SUCCEEDED_NAME = "Succeeded"
static final String ATTR_MAX_LEVEL_NAME = "Current level";

Map  values = new HashMap ();

boolean result = uploadHighScores();

values.put(ATTR_SUCCEEDED_NAME, String.valueOf(result));
if(result == false)
{
    values.put(ATTR_ERROR_MSG_NAME, getStoredErrorMessage());
    // Error handling code here.
}
else
{
    values.put(ATTR_MAX_LEVEL_NAME, String.valueOf(this.lastLevel));
    // Show the user the high scores page.
}

Download the latest version of our libraries to start using this feature and for some tips and best practices.

Share this
Share