You probably went through the three minute tutorial, and learnt the basics of DeskMetrics Analytics, such as downloading our assembly, adding it CLASSPATH 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.
The DeskMetrics Analytics Java API is, basically, 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 Java API code at Github
It is a singleton. For short, you can use it this way:
import com.DeskMetrics.DeskMetrics;
//gets the instance
DeskMetrics tracker = DeskMetrics.getInstance();
//initializes the application. you *must* do it.
tracker.start("your_app_id_here", "1.0");
// call this before the application finishes. you *must* do it
tracker.stop();
Note
You can get your application id at http://analytics.deskmetrics.com/
The complete com.DeskMetrics.DeskMetrics class documentation is shown below:
You must call this method. It is responsible for getting environment informations, such as processor, operating system and Java version.
You must call this method just before your application ends. It is responsible for sending the data to DeskMetrics Analytics’ servers.
Simple event tracking.
Simple event tracking with an extra (“value”) option enabled.
Tracks an customized data (useful for emails, telephone, extra system configuration, etc)
Does the same thing as trackCustomData, but sends the data in real time.
Simple log utility.
Tracks events related to time and intervals. It is useful for long-time operations (like disk defragmentation, big files download, and so on). Time must be specified in seconds.
Tracks an exception and its details, such as stack trace and message.