You probably went through the three minute tutorial, and learnt the basics of DeskMetrics Analytics, such as downloading our SWC, adding it as a compiler 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.
The DeskMetrics Analytics dotNet 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 C# API code at Github
This is the basic DeskMetrics Analytics API class. Its basic usage looks like:
using DeskMetrics;
//...
Watcher watcher = new Watcher();
//as the application starts:
watcher.Start("your_app_id","1.0");
//as your application ends:
watcher.Stop();
These are the two basic methods of the Watcher object.
Note
You can get your application id at http://analytics.deskmetrics.com/
The Watcher object has the following methods:
Required function. Initializes the application by collecting some environment characteristics like operating system, Java and .NET version, processor, RAM usage and totals.
Required function. Must be called just before the application closes.
This method sends the data stats that were cached locally until now. It is specially useful for applications that are never supposed to be closed. It is also asynchronous, so your users won’t experience lags or performance issues.
Simplest event tracking. You can use it on button clicks, form loads or another user-triggered event.
Tracks events with the extra “Value” option.
Tracks custom data, like an specific user input. It can be useful when you want to get custom data without using TrackLog or TrackEventValue.
Tracks custom data in real time, without waiting for the scheduler to send it later. It throws an exception if the server communication can’t be established (e.g. no internet access).
Just like TrackCustomDataR, but it stores the custom data if it can’t be sent in real time.
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 EventTime parameter is the time spent on the event (in seconds) and the Completed parameter is used to inform DeskMetrics Analytics if the event was successfully completed (false if it was cancelled/aborted or true, otherwise).
Simple log tracking.
Tracks an exception with its attributes (stack trace, source, target site and message).
Services object. Useful for some proxy and timeout configurations. See its documentation below.
Responsible for the DeskMetrics Analytics API’s communication layer. It has some public attributes which can be used to configure some aspects of the network communication between DeskMetrics Analytics’ users and servers.
Default: null. Specify a proxy host or IP.
Default: null. Specify a proxy user name, if the proxy has authentication.
Default: null. Specify a password for accessing the proxy.
Default: null. Specify the proxy port.
Default: 80. Specify which port will be used to send data to DeskMetrics Analytics’ server. It supports two values: 80 (http) and 443 (https);
Default: 25000. Timeout value in milliseconds.