WP7 app analytics using mTiks in just 5 minutes
This post is part of a follow up series on my TechDays session on “Making Money with Windows Phone applications”. See this post for more info and an index.
Why build in analytics into your mobile application? This subject has been covered in many blog posts an their conclusion is usually the same. First of all you just want to know how many people use your app and how often they do it. But knowing (at least to some extent) what part of your app is used the most and what epic feature is never found by users is also valuable.
As a developer there’s plenty of frameworks to choose from:
- Google Analytics (using MSAF)
- Flurry
- Preemptive Runtime Intelligence (less interesting since their deal with MS ended)
- mTiks
In this post I will cover mTiks, since it’s just too easy to get started. You’ll be able to instrument your app in literally just a few minutes.
Preparation
Let’s take a look at the easy steps to get started:- Sign-up at the mTiks website
- Add your app to the list in you account. If you don’t have a marketplace url yet, just enter a – or anything
- Take note of the code for your app by selecting your new app from the list.
- Download the WP7 binary
Setup
Now you’re all set to integrate mTiks into your application, start by opening up your project in Visual Studio. Now follow these steps:- In WMAppManifest.xaml make sure the following capabilities are set <Capability Name=”ID_CAP_IDENTITY_DEVICE”/> <Capability Name=”ID_CAP_IDENTITY_USER”/>
- Add a reference to mtiks.dll
- Open up your App.xaml.cs and add the following usings using com.mtiks.winmobile; using System.Reflection;
- Now all you need to do to start measuring is add the following code to the app’s lifecycle events
// Code to execute when the application is launching (eg, from Start) // This code will not execute when the application is reactivated private void Application_Launching(object sender, LaunchingEventArgs e) { mtiks.Instance.Start("<code>", Assembly.GetExecutingAssembly()); } // Code to execute when the application is activated (brought to foreground) // This code will not execute when the application is first launched private void Application_Activated(object sender, ActivatedEventArgs e) { mtiks.Instance.Start("<code>", Assembly.GetExecutingAssembly()); } // Code to execute when the application is deactivated (sent to background) // This code will not execute when the application is closing private void Application_Deactivated(object sender, DeactivatedEventArgs e) { mtiks.Instance.Stop(); } // Code to execute when the application is closing (eg, user hit Back) // This code will not execute when the application is deactivated private void Application_Closing(object sender, ClosingEventArgs e) { mtiks.Instance.Stop(); }
Event tracking
To collect a little more information on how your app is used there’s the option to track events. Just like the above steps it’s just ridiculously easy. There’s only two calls you need to know. Use mtiks.Instance.postEventAttributes(“<name>”); to simply count an event. It will give you a counter in the mTks dashboard. Use mtiks.Instance.postEventAttributes(“<name>”,Dictionary<string,string>) to collect a dictionary of attributes which can also be viewed through the dashboard. For example: mtiks.Instance.postEventAttributes(“<name>”,new Dictionary<string,string>{{“attribute1″,”value1”},{“attribute2″,”value2”}});It’s free!
Now that you got everything up and running there’s one thing that really needs to be emphasized. mTiks offers all of this totally free. So there’s basically no reason to not implement this. It will give you valuable data that will come in handy some day. Just remember to respect your user’s privacy, so don’t collect any personal information (if applicable) through mTiks. If you have any questions or comments regarding this article feel free to contact me through the comments, contact form or Twitter.Tags: analytics, monetizing, mtiks, techdaysnl, windows phone 7, wp7dev, wp7nl, wpdev
Trackback from your site.