DeskMetrics Analytics for Objective-C - Complete API reference

You probably went through the three minute tutorial, and learnt the basics of DeskMetrics Analytics, such as downloading our framework, adding it as a reference and making a simple example using the DeskMetrics Analytics’ platform. If you haven’t done so, we recommend checking it out it before reading the complete documentation.

Basic information about DeskMetrics ANalytics API

The DeskMetrics Analytics Objective-C API is, for short, a wrapper for the DeskMetrics Analytics web service API. Its basic role is to take the data collected, serialize it into a JSON string and finally send it to DeskMetrics’ servers.

There are a few more features, like caching and background data sending (through a separate thread); If you are curious about our implementation, check our Objective-C API code at Github

This library is kindly provided by Jørgen Tjernø (http://github.com/jorgenpt/)

If you want to know about DeskMetrics Analytics HTTP API, check out this guide.

The DMTracker class

(void)startApp;

Required to get DeskMetrics Analytics working. This method is responsible for environment information gathering. You must call this method when your application starts.

Note

If you have already seen another DeskMetrics Analytics library, you are probably asking yourself why we don’t pass the Application ID and the Application version to startApp. In this case, these values are set on Info.plist file, using the keys DMAppId and DMAppVersion.

(void)trackEventInCategory:(NSSTring *) theCategory withName:(NSString *) theName;

Simplest event tracking. You can use it on button clicks, form loads or another user-triggered event.

(void)trackEventInCategory:(NSString *)theCategory withName:(NSString *)theName value:(NSString *)theValue;

Tracks events with the extra “Value” option.

(void)trackEventInCategory:(NSString *)theCategory withName:(NSString *)theName secondsSpent:(int)theSeconds completed:(BOOL)wasCompleted;

This method can be used to track time-consuming operations (like a form-fill by a user or a disk defragmentation by some utility tool).

The secondsSpent parameter is the time spent on the event and the completed parameter is used to inform to DeskMetrics Analytics if the event was successfully completed (false if it was cancelled/aborted or true, otherwise).

(void)trackLog:(NSString *)message;

Simple logging feature.

(void)trackCustomDataWithName:(NSString *)theName value:(NSString *)theValue;

Tracks custom data, like an specific user input. It can be useful when you want to get custom data without using TrackLog or TrackEventValue.

(void)trackCustomDataRealtimeWithName:(NSString *)theName value:(NSString *)theValue;

Tracks custom data in real time, without waiting for the scheduler to send it later.

(void)trackException:(NSException *)theException;

Tracks an exception with its attributes (stack trace, source, target site and message).

Note

Looking for the stop method? That’s is another Objective-C library difference: the stop method is called automatically when your application finishes, so you don’t need to worry about it.