Mobile Tracking Library Introductory Guide
From Medialets Developer Documentation
Medialets Mobile Tracking Library makes it easy to track events in your CocoaTouch application. Events are recorded locally, cached, and shipped off in bulk to Medialets' Medialytics server for recording and analysis.
Contents |
Component Overview
Default Tracking
By default, Medialytics records a great deal of useful information without you having to tell the Tracking Manager anything. Initially, the tracking library just tracks application launch and termination. This may not sound like much, but by tracking these events, Medialytics also records the type and model of device the application was running on, the operating system version, the device identifier, your application's version and the location where the application was run. This lets you answer questions like "how many unique devices ran my application this week?" and "how many new users ran my app?" and "how many users in the UK only ran my application once?" and "how many users of my application are using the iPhone 3G?".
Location Tracking
All Cocoa Touch applications are location aware, and with the inclusion of GPS on the iPhone 3G, your location-aware applications can have an unparalleled level of precision. Medialytics enables you to find out where your application is being used. Version 2.0 of the iPhone OS brings with it increased user location privacy controls. Therefore, the first time a location-aware app is run, the user sees a pop-up that asks for their explicit permission for that app to use location-aware features. If your application doesn’t use locations for anything else and you don’t want your users to be presented with this pop-up, there is a method within the Medialets Tracking Library that disables location tracking for your application.
Custom Event Tracking
Medialets lets you custom-tailor its tracking to your application, allowing you to track any event you like. All you need to do is tell Medialets when the event happens by passing a key for the event. Medialets records the event under your key and it can even store a dictionary of any additional data associated your event. Additionally Medialets can observe notifications for you and record them as notification events. All of your custom data is available on the Medialytics site or as downloadable CSV files that you can process yourself. Event Posting
Your users will doubtlessly be using your apps all the time; even when they’re not connected to the Internet, and Medialets is designed to report events even if they’re not connected at that moment. To make the transmission of event data to Medialets’ servers as painless, reliable and low impact as possible, all reported events are cached locally in an automatically created SQLite database. Periodically, when your application is running and is connected to the Internet, it transmits all queued events to the server, removing them from the local cache when it gets an acknowledgement from the event recorder on the Medialytics server.
Analytics at Medialytics.com
All your information gathered using the Mobile Tracking Library comes together at medialets.com, the Medialets data analysis platform. Using Medialytics powerful analysis tools, not only is all your applications data made readily available, but its also easily understandable thanks to its flexible data display and relatable powerful charting systems. And just as you can custom-tailor event reporting within your application, you can create custom reports in Medialytics allowing you to compare the most relevant data and metrics to your app. Plus, all data in Medialytics is natively exportable as downloadable CSV files, so you can perform further analysis or share the data.
Using the Medialets Mobile Tracking Library In Your Application
Register Your Application
Point your browser to medialytics.com. If you’ve previously signed up at Medialytics, simply sign in. Otherwise sign up as a developer.
Once you’ve registered or signed in, you’ll be taken to your Dashboard landing page, where, if this is your first Medialytics application, you’ll be prompted to Create a New App, which involves giving it a name, a version, and a product category.
Once you’ve registered your app, you’ll be given a unique application ID, and returned to your app’s Dashboard. If you ever need to find your Application ID, it’s located on the bottom of your dashboard and on the My Apps page.
Integration With Your Application Project
Step 1) Add your application's unique ID to the project's Info.plist file. You can find your application’s unique ID on the bottom of its Dashboard:
Use the Key of MMAppID and use the Value of the App ID you got from the Medialytics application when you registered your application.
Step 2) Add these standard frameworks to your project if you are not already using them:
Frameworks: * libsqlite3.0.dylib * SystemConfiguration.framework * CoreLocation.framework
Select Frameworks and right-click and select Add > Existing Frameworks... then navigate to: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk. Under there go to .../System/Library/Frameworks/ where you will find CoreLocation.framework and SystemConfiguration.framework. The SQLite library can be found, under the same SDK, at: .../usr/lib/libsqlite3.0.dylib
Step 3) Add the Medialets Mobile Libraries to your project: Frameworks: libMMTrackingDevice.a libMMTrackingSimulator.a
Select Frameworks and right-click and select Add > Existing Frameworks... then add the two libraries included in the tracking support download: libMMTrackingDevice.a (which supports tracking on the device) and libMMTrackingSimulator.a (which will let you test your code on the simulator.) Tell Xcode to copy the files into your project.
Step 4) Add the Tracking Manager's header file to your project:
Other Sources:
MMTrackingMgr.h
Select Other Sources and right-click and select Add > Existing Files... then add the header file included in the tracking support download. Tell Xcode to copy the file into your project.
Step 5) Edit your application delegate class and add the header #import statement for MMTrackingMgr.h and one line ([[MMTrackingMgr sharedInstance] startDefaultTracking];) to your initialize method:
#import “MMTrackingMgr.h”
@implementation myApp
+ (void)initialize {
[[MMTrackingMgr sharedInstance] startDefaultTracking];
}
And you are done!
(If you don’t want the user to have to see the one-time pop-up that the location system runs, asking the user if it is OK to let the application use your location, you can disable location tracking entirely. Use this line instead: [[MMTrackingMgr sharedInstance] startDefaultTrackingWithoutLocation];)
Medialytics Guide Feedback
We're always looking to improve our documentation. If you have any thoughts on the Medialytics Guide, let us know at Talk:Mobile Tracking Library Introductory Guide.
