Implementing Custom Metrics in Quantum Visualizer
To implement custom metrics in Quantum Visualizer, send data from your application to the custom metrics in Quantum Cloud. You can also send custom metrics by calling a new API in Quantum Visualizer, KNYMetricsService.sendCustomMetrics (<form_name>,<json string>)
.
This API will initiate a service callback to Quantum Server in a development cloud with service ID as capturekonycustommetrics.
To define metrics in Quantum Visualizer, follow these steps:
- In Quantum Visualizer, design a form for an application.
- To implement the metrics for an application in Quantum Visualizer, choose one of the following methods:
- Right-click on a form element. Define the metrics using
KNYMetricsService.sendCustomMetrics
in an onClick event by adding a code snippet to the Action Sequence. - Configure the metrics in a code module.
- Right-click on a form element. Define the metrics using
- Define the metrics.
- The supported formats for key values are as follows:
Each JSON object in the following formats correspond to one set of associated data.
/* Array of JSON Objects with single key: */
/* The following format is used if data is not associated. For example, met1 and met2 are unassociated data points. */ [ { "met1": "metVal1" }, { "met2": "metVal2" } ] /* JSON Array with single JSON object with multiple keys: */ /* The following format is used for sending a single set of associated data. For example, you can check the value of met2 when the value of met1 is metVal1. */ [ { "met1": "metVal1", "met2": "metVal2" } ] /* JSON array with multiple JSON objects: */ /* The following format is used for sending or collecting multiple sets of associated data */ [ { "met1": "metVal1", "met2": "metVal2" }, { "met1": "metVal3", "met2": "metVal4" } ]The following example shows a custom metrics code defined for an element in Quantum Visualizer.
var custmetrics = [{"onSale":true,"prodName":"iPad 16 GB","prodPrice":450.0,"salePrice":400.0,"prodSKU":"1231sdf2","rating":4.5}] KNYMetricsService.sendCustomMetrics("frmProduct", custmetrics)
For more information about metrics APIs, refer to SDK documentation.
- The supported formats for key values are as follows:
- After you define the Custom Metrics in Quantum Visualizer, rebuild and publish the application to the same cloud for which the custom metrics was defined.
-
After the application is published and the appropriate trigger point is hit (button click or form load wherever the earlier API is called), metrics will be sent to cloud and stored for reporting purposes.
NOTE: After the data is sent from an application, it takes about 15-20 minutes for the data to reflect on cloud reports.