API Docs for: 0.0.0

Class EqatecAnalytics.Monitor

ForceSync ( )

Explicitly force a synchronization of the current information with the analytics server. This call is not expected to be used in a standard setup but may be helpful in occasionally connected scenarios. If you created the monitor instance by explicitly setting SynchronizeAutomatically to false this method is how you can force the monitor to synchronize. The monitor must have been created prior to this call using a Factory.Create method.

Example
   window.plugins.EqatecAnalytics.Monitor.ForceSync();
GetStatus (successCallback)

The monitor must have been created prior to this call using a Factory.Create method.

Parameters:
  • successCallback <Function>

    The success callback where the status will be returned as a JSON object. Note that all properties in the object will be strings, even numeric or boolean values

Example
   window.plugins.EqatecAnalytics.Monitor.GetStatus(function(status) {
     console.log("Monitor status:");
     for (var key in status)
       console.log("  " + key + "=" + status[key]);
   });
SetInstallationInfo (installationID)

Associate an installation ID with the current monitor and current session. The monitor must have been created prior to this call using a Factory.Create method.

Parameters:
  • installationID <Object>

    any given string that would suitably identify the installation

Example
   window.plugins.EqatecAnalytics.Monitor.SetInstallationInfo(user.id);
SetInstallationInfoAndProperties (installationID, installationProperties)

Associate an installation ID with the current monitor and allows for further installation properties to be associated with the current session. The monitor must have been created prior to this call using a Factory.Create method.

Parameters:
  • installationID <Object>

    any given string that would suitably identify the installation

  • installationProperties <Object>

    a JSON object with key-value pairs to register for this installation and this session

Example
   window.plugins.EqatecAnalytics.Monitor.SetInstallationInfo(user.id, 
     { name:user.name,
       company:account.company,
       license:account.license,
     });
Start (successCallback)

Start the monitor. Note that none of the tracking calls have any effect before this call. Repeated calls have no effect as only one monitoring session can be started The monitor must have been created prior to this call using a Factory.Create method.

Parameters:
  • successCallback <Function>

    The success callback, called when the monitor has been started

Example
 var factory = window.plugins.EqatecAnalytics.Factory;
 // Create the monitor instance using the unique product key
 var productId = "ae9827b48d5441a084a2XXXXXXXXXXXX";
 window.plugins.EqatecAnalytics.Factory.CreateMonitor(productId, null,
   function() {
     console.log("Monitor created");
     // Start the monitor
     window.plugins.EqatecAnalytics.Monitor.Start(function() {
       console.log("Monitor started");
     });
   },
   function(msg) {
     console.log("Error creating monitor: " + msg);
   });
Stop (successCallback)

Stop the monitor. By stopping the monitor an attempt to deliver the last data to the servers are made. If data could not be delivered it will be attempted to deliver the data again on the next start of the monitor with the same product id. The monitor must have been created prior to this call using a Factory.Create method.

Parameters:
  • successCallback <Function>

    The success callback, called when the monitor has been stopped

Example
 // Stop the monitor
 window.plugins.EqatecAnalytics.Monitor.Stop(function() {
   console.log("Monitor stopped");
 });
StopWithTimeout (waitForCompletionInSeconds, successCallback)

Stop the monitor with a specified timeout. By stopping the monitor an attempt to deliver the last data to the servers are made. If data could not be delivered it will be attempted to deliver the data again on the next start of the monitor with the same product id. The monitor must have been created prior to this call using a Factory.Create method.

Parameters:
  • waitForCompletionInSeconds <Number>

    The timeout period in seconds

  • successCallback <Function>

    The success callback, called when the monitor has been stopped

Example
 // Stop the monitor
 window.plugins.EqatecAnalytics.Monitor.StopWithTimeout(5, function() {
   console.log("Monitor stopped");
 });
TrackExceptionMessage (exception, message)

Track an exception with a context message. Delivers the exception information to the server as soon as possible.

Parameters:
  • exception <Object>

    the exception-object, for instance an Error

  • message <String>

    the free-form message providing further details about this particular error scenario

Example
   try
   {
      // code that throws an Error
   }
   catch (ex)
   {
     window.plugins.EqatecAnalytics.Monitor.TrackExceptionMessage(ex, "Context info");
   }
TrackFeature (featureName)

Track a named feature. Note the recommended use of a one-level dot-notation for feature naming to allow for better grouping of related features. Tracked features are not delivered to the server immediately but are piggy-backed on the next delivery.

The monitor must have been created prior to this call using a Factory.Create method.

Parameters:
  • featureName <String>

    the feature name

Example
   window.plugins.EqatecAnalytics.Monitor.TrackFeature("MenuFile.SaveAll");
TrackFeatureCancel (featureName)

Stop an ongoing time tracking of a named feature within registering the time. This call can be used in the feature being time did not complete as expected such as an exception occurring or the user canceling the activity. The monitor must have been created prior to this call using a Factory.Create method.

Parameters:
  • featureName <String>

    the feature name

Example
   window.plugins.EqatecAnalytics.Monitor.TrackFeatureStart("Imaging.ProcessFolder");
   try
   {
     // do processing
     window.plugins.EqatecAnalytics.Monitor.TrackFeatureStop("Imaging.ProcessFolder");
   }
   catch (ex)
   {
     window.plugins.EqatecAnalytics.Monitor.TrackFeatureCancel("Imaging.ProcessFolder");
     window.plugins.EqatecAnalytics.Monitor.TrackExceptionMessage(ex,
                            "Image processing failed for " + folder.name);
   }
TrackFeatureStart (featureName)

Start time tracking of a named feature. Note that the timing is not recorded before a matching TrackFeatureStop has been called and that there is no support for multiple concurrent timings of the same named feature so multiple start calls without a matching stop for the same feature will have no effect. The monitor must have been created prior to this call using a Factory.Create method.

Parameters:
  • featureName <String>

    the feature name

Example
   window.plugins.EqatecAnalytics.Monitor.TrackFeatureStart("Imaging.ProcessFolder");
   try
   {
     // do processing
     window.plugins.EqatecAnalytics.Monitor.TrackFeatureStop("Imaging.ProcessFolder");
   }
   catch (ex)
   {
     window.plugins.EqatecAnalytics.Monitor.TrackFeatureCancel("Imaging.ProcessFolder");
     window.plugins.EqatecAnalytics.Monitor.TrackExceptionMessage(ex,
                            "Image processing failed for " + folder.name);
   }
TrackFeatureStop (featureName)

Stop time tracking of a named feature. Note that this has no effect if there has not been a matching TrackFeatureStart. The monitor must have been created prior to this call using a Factory.Create method.

Parameters:
  • featureName <String>

    the feature name

Example
   window.plugins.EqatecAnalytics.Monitor.TrackFeatureStart("Imaging.ProcessFolder");
   try
   {
     // do processing
     window.plugins.EqatecAnalytics.Monitor.TrackFeatureStop("Imaging.ProcessFolder");
   }
   catch (ex)
   {
     window.plugins.EqatecAnalytics.Monitor.TrackFeatureCancel("Imaging.ProcessFolder");
     window.plugins.EqatecAnalytics.Monitor.TrackExceptionMessage(ex,
                            "Image processing failed for " + folder.name);
   }
TrackFeatureValue (featureName, featureValue)

Track a value associated with a feature name. This tracking will associate the given value with the feature and allow you to inspect e.g. the distribution of value server side The monitor must have been created prior to this call using a Factory.Create method.

Parameters:
  • featureName <String>

    the feature name

  • featureValue <Number>

    the value for the feature

Example
   window.plugins.EqatecAnalytics.Monitor.TrackFeatureValue("Imaging.FolderSize", folder.length);