API Docs for: 0.0.0

Class EqatecAnalytics.Factory

CreateMonitor (productId, version, successCallback, failureCallback)

Create the EqatecAnalytics monitor.

Parameters:
  • productId <String>

    The numeric product id, e.g. "B568811797BD4419B50631716F0359AD"

  • version <String>

    An optional application version, e.g. "1.2.3"; if null or empty, the app version will be deduced automatically

  • successCallback <Function>

    The success callback, called when a monitor is created

  • failureCallback <Function>

    The error callback, called if a monitor could not be created

Example
 // 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);
   });
CreateMonitorWithSettings (settings, successCallback, failureCallback)

Create the EqatecAnalytics monitor with more detailed settings.

Parameters:
  • settings <Object>

    Detailed settings, created by Factory.CreateSettings:

    • ProductId <String>

      The numeric product id, e.g. "B568811797BD4419B50631716F0359AD"

    • Version <String>

      An optional application version, e.g. "1.2.3"; if null or empty, the app version will be deduced automatically

    • LocationCoordinates <Object>

      Use this for geolocation. It has these two members:

      • Latitude <Number> The latitude
      • Longitude <Number> The longitude
    • ProxyConfig <Object>

      Specific proxy-configuration. It has these four members:

      • Host <String> the proxy hostname
      • Port <Number> the proxy port
      • UserName <String> the authorizing username
      • Password <String> the authorizing password
    • LoggingInterface <Object>

      An object that will be called back with log messages. The object must implement these two functions: A default logger printing to console.log can be created using CreateTraceLogger.

      • LogError <Function> Log a string error message from the monitor
      • LogMessage <Function> Log a string message from the monitor
    • DailyNetworkUtilizationInKB <Number>

      Daily data transfer limit; default is 2147483647 KB

    • MaxStorageSizeInKB <Number>

      Disk storage limit; default is 2147483647 KB

    • ServerUri <String>

      Advanced; point session data to a specific server

    • StorageSaveInterval <Number>

      Save statistics this often, in seconds; default is 60 sec

    • SynchronizeAutomatically <>

      Set to false for offline scenarios in concert with ForceSync

    • TestMode <Boolean>

      Mark data from this monitor session as originating from internal usage

    • UseSsl <Boolean>

      Use HTTPS instead of HTTP

  • successCallback <Function>

    The success callback, called when a monitor is created

  • failureCallback <Function>

    The error callback, called if a monitor could not be created

Example
 var factory = window.plugins.EqatecAnalytics.Factory;
 // Create the monitor instance using detailed settings
 var productId = "ae9827b48d5441a084a2XXXXXXXXXXXX";
 var settings = factory.CreateSettings(productId);
 settings.LoggingInterface = factory.CreateTraceLogger(); // please log
 factory.CreateMonitorWithSettings(settings,
   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);
   });
CreateSettings (productId, version)

Create settings suitable for passing to Factory.CreateMonitorWithSettings.

Parameters:
  • productId <String>

    The numeric product id, e.g. "B568811797BD4419B50631716F0359AD"

  • version <String>

    An optional application version, e.g. "1.2.3"


Returns:

A settings object in JSON

Example
 var factory = window.plugins.EqatecAnalytics.Factory;
 // Create the monitor instance using detailed settings
 var productId = "ae9827b48d5441a084a2XXXXXXXXXXXX";
 var settings = factory.CreateSettings(productId);
 settings.LoggingInterface = factory.CreateTraceLogger(); // please log
 factory.CreateMonitorWithSettings(settings,
   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);
   });
CreateTraceLogger ( )

Create the logger for outputting diagnostics from the monitor. You can build your own logger and pass it along in the settings when creating a monitor using Factory.CreateMonitorWithSettings or you can use this one, which will output to the standard console.log.


Returns:

A logger suitable for passing to the monitor in a settings object

Example
 var factory = window.plugins.EqatecAnalytics.Factory;
 // Create the monitor instance using detailed settings
 var productId = "ae9827b48d5441a084a2XXXXXXXXXXXX";
 var settings = factory.CreateSettings(productId);
 settings.LoggingInterface = factory.CreateTraceLogger(); // please log
 factory.CreateMonitorWithSettings(settings,
   function() { console.log("Monitor created"); },
   function(msg) { console.log("Error creating monitor: " + msg); }); 
IsMonitorCreated (successCallback)

Detect whether the monitor has already been created by one of the Create-methods and therefore is alive and cannot be created again.

Parameters:
  • successCallback <Function>

    Called with JSON string result IsCreated indicating "true"/"false" whether the monitor has already been created

Example
     window.plugins.EqatecAnalytics.Factory.IsMonitorCreated(function(result) {
       if (result.IsCreated == "true") {
         // Monitor has already been created
       } else {
         // Monitor has not been created yet
       }
     });