DEVELOPERS BLOG

Learn how users interact with your app using Flurry Analytics

Are you a BlackBerry WebWorks / HTML5 developer like me who has an almost unhealthy need to know what user’s are doing while using your BlackBerry 10 application? Well I have some great news for you! Flurry Analytics has recently released a free HTML5 SDK for their analytics service and it is AWESOME.

Whether you’re looking to track simple application usage, or more in-depth analytics, Flurry has got you covered. Integrating the SDK into your project will literally take a few minutes and provide you with a ton of information on how your app is being used.

The basic usage of the SDK allows you to track quite a bit of stats right out of the box and enabled you to see analytics surrounding app Usage (Active Users, Sessions, Session Length, Frequency of Use, etc.).

Event Analytics

If you want to get much more detailed, and if you’re anything like me I’m sure you do, Flurry also provides you with Event analytics.

Events can essentially be anything you want them to be. By executing one line of code in your app during an “event” you’re able to start tracking occurrences of said event, and see how often the event is being triggered in your app.

This can really come in handy when you’re looking for ways to monetize your app. In one of my own applications, Filter Mama, I wanted to know which photo filters and effects users were using the most. By collecting event analytics I was able learn which filters users added most often, and was able to focus on creating new ones based upon the most popular effects.

Integration

Adding Flurry to your project is super easy, and literally takes only a few lines of code.

function initApp() {

   // set the application version number

   FlurryAgent.setAppVersion(blackberry.app.version);

// set the os version

   var env = {

      ‘os’: blackberry.system.softwareVersion

   };

   // Annnnnd GO!

   FlurryAgent.startSession(‘<your API key here>’);

   FlurryAgent.logEvent(‘environment’, env);

}

Adding events is just as easy, and can be as simple or detailed as you want. Here we’re simply logging the event name as a String, but this could be an Object, or really, any type data is relevant to you and your application.

// Event 1

function eventOne() {

   FlurryAgent.logEvent(‘Event 1’);

   console.log(‘Triggered: Event 1’);

}

// Event 2

function eventTwo() {

   FlurryAgent.logEvent(‘Event 2’);

   console.log(‘Triggered: Event 2’);

}

I’ve written a small sample app, which shows you how to integrate Flurry into your BlackBerry WebWorks application and begin gathering analytics. I’ve included both the basic usage, as well as how to trap events within your app.

Check out the Flurry Analytics sample in our GitHub Repository.

If you find this sample useful, have any questions, or just want to keep up-to-date on the world of BlackBerry WebWorks and HTML5, follow me on Twitter @chadtatro!

Chad Tetreault

About Chad Tetreault

A developer at heart, I’ve been coding in some shape or form since the age of 13. Nowadays I focus on building awesome cross-platform (Android, iOS, BlackBerry) mobile web applications powered by Cordova, JavaScript, and AngularJS.