July 10, 2013

Integrating Flurry Analytics into your iOS App

Flurry Analytics is a great service for keeping tabs on mobile app usage. They help over 100,000 companies monitor 300,000 apps that run on a variety of platforms (iOS, Android, Windows Phone and more). Best of all, it's free to use Flurry Analytics in your own apps.

My goal with this blog entry isn't to come across like a sales pitch. If you have a different analytics service that fits your needs, then more power to you. The point is to use something. Measuring unique users, sessions, new users and then visualizing these attributes over the course of time can reveal some powerful trends. The results might help you prioritize certain features or bug fixes. Maybe the information will help you plan the timing of your next sale. The data adds value as an anonymous source of feedback from your users that'll enable you to be an even better steward of your app.

So what do you need to do to get started with Flurry? First go to their website and sign up (or log in if you already have an account). In the "Applications" tab click the "Add a New Application" link and choose a platform. On the next page name the app and assign a category. You'll be greeted with a "Unique Application Key". Save this key for later and then click the button to download the SDK.

The code sample in this post will illustrate how to use the iOS SDK to integrate Flurry into your app. For MonoTouch (aka Xamarin.iOS) developers I'd advise taking a look at the FlurryAnalytics folder in the monotouch-bindings project. For other platforms, visit Flurry's "Getting Started" documentation.

Continuing with our objective-c / iOS example, add the Flurry lib (found in the SDK you downloaded) to your project. You will also need to link your project against the SystemConfiguration.framework. Now move into your app delegate code, replacing YOUR_API_KEY with the Application Key Flurry assigned to you:

#import "Flurry.h"

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [Flurry startSession:YOUR_API_KEY];

  // Other code here... 
}

This illustrates the bare minimum to get you started - very little code in exchange for some powerful analytics...

No comments: