August 20, 2014

Shortening a UUID / GUID in Swift

Universally Unique Identifiers (UUID, also known as a GUID on Windows) are a helpful standard for identifying things uniquely among the throng. To make sure that for all intents and purposes each UUID is unique it has to be 36 characters long. When transferred over a network on a large scale, these lengthy identifiers will eat up bandwidth. In the spirit of optimization, what's a good strategy to compress them for transit?

Jeff Atwood has a helpful article on the topic. Spoiler alert: his conclusion is that ASCII85 encoding can be used to compress a UUID down to 20 characters.

I implemented a base64 solution as an excuse to get better acquainted with Swift. The downside of using base64 is that it yields a 22 character compressed UUID. The upside is that a base64 implementation is built into Cocoa / Cocoa Touch. If you go with ASCII85 you'll have to roll your own implementation.

Please keep in mind that additional changes will need to be made to this solution if the intent is to pass the compressed UUID as part of a url string (eg. '+' and '/' characters, etc will need to be dealt with). Try it out for yourself in a Swift playground!

July 16, 2013

Flutter - An iOS Dashboard for Flurry Analytics

In my previous post I discussed analytics services in the context of mobile applications. In particular, I focused on Flurry Analytics and included a code sample demonstrating how to integrate this service into an iOS application.

So what's the next step? As either a mobile developer or marketing expert, you probably want the ability monitor the data collected by Flurry Analytics so you can identify and respond to trends. To meet this need, the Flurry website offers some powerful tools for visualizing how your applications are used. It breaks down numbers by country, version, device, operating system, new user, active user, session and more. This tool is comprehensive and allows users to generate a wide variety of custom reports. While it functions on mobile devices, the experience is far from optimized.

Being a developer with several Flurry-enabled apps in the App Store, I searched for a mobile-friendly solution. I wanted a native iOS app that would make it easy to check my usage statistics on the go. I didn't want the kitchen sink, just the analytics that were most relevant and the ability to visualize trends over time. Several options already existed in the App Store, but none were elegant or easy to use. Having recently completed the iOS & Mac Application Development Certification Program through the University of Washington I thought I'd try my hand at writing an app in objective-c to address this need.

Two and a half months later, I finished work on Flutter and pushed it to the App Store. Flutter is a dashboard for viewing Flurry Analytics on an iOS device. It focuses on primary usage statistics such as active users, new users and sessions. Custom events and multiple companies are also supported. Graphs and totals can be evaluated over some of the most common date ranges (Today, Yesterday, 1 Week, 1 Month, 6 Months, 1 Year). Flutter makes use of many powerful open source technologies including CorePlot, PKRevealController, ESNetworking and SVProgressHUD.

Learn more and download Flutter today! I'd love to hear your feedback.

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...