Medialets Analytics SDK 2.x for Android


Skip to end of metadata
Go to start of metadata


Event Analytics

The Medialets Analytics SDK allows you to record instances of virtually any event that occurs in your application by defining Custom Events. Whenever the desired event occurs in your application, the event instance is stored for transmission to the Medialets Muse™ server. Additionally, a catalog of other data associated with your event can be included in what is sent. The gathered data is available in reports on Medialets Muse™ and can be downloaded as a .cvs files for offline processing.

Custom Events

Add Custom Event capture to your application simply by calling the trackEvent() method of your MMAnalyticsManager instance like this:

MMAnalyticsManager.sharedInstance().trackEvent(new MMEvent("Name of Event"));

By executing the code above, an event with the name you provide (shown as "Name of Event" in the example) will be stored in a local database for subsequent transmission to our servers. All event instances with the same name are aggregated and their statistics will be displayed in reports on Medialets Muse™.

Complex Events

To gather more detailed event data, create a Complex Event.

Timers and Counters

If, for example, you wanted to track how many times and for how long a user interacted with a specific screen, you can easily track this using MMEvent's startTimerForKey and endTimerForKey. Below is pseudocode that shows how this is accomplished:

//where appropriate, place to declare the event object
MMEvent screenEvent;
.
.
//where appropriate, instantiate the event object
screenEvent = new MMEvent("Screen 1 Event");
.
.
// screen is displayed
screenEvent.startTimerForKey("DisplayDuration");
screenEvent.incrementNumberForKey("DisplayCount");
.
.
// screen is no longer displayed
screenEvent.endTimerForKey("DisplayDuration");

Collections

If, for example, you are writing a game and are storing the user's score for each level of the game in a Map, you can easily associate this type of information with an event. Below is pseudocode that shows how this is accomplished:

//where appropriate, declare the event object
 MMEvent levelScoresEvent;
.
.
//where appropriate, instantiate the event object
levelScoresEvent = new MMEvent("User Level Scores");
.
.
// user exits the game
// store the level scores in a Map
Map levelScores = new Map();
levelScores.put("level1", new Double(game.levelOneScore()));
levelScores.put("level2", new Double(game.levelTwoScore()));
levelScores.put("level3", new Double(game.levelThreeScore()));

// add the Map of level scores to the event
levelScoresEvent.addNumbersFromMap(levelScores);



<< PREVIOUS PAGE: Using Medialets Analytics SDK

NEXT PAGE: Activity Logging for Development >>

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.