Legacy io.Insights
Overview
The Metrics API is accessible through io.metrics()
.
FAV Metrics
To publish a FAV metric, use the featureMetric()
method:
io.metrics().featureMetric("MyFeature", "MyAction", "MyValue");
Click Stream Metrics
Available since io.Connect Desktop 9.3
Click Stream metrics are enabled by default. You can use the library configuration file (e.g., glue.conf
, glue.json
, etc.) located in your app classpath to enable or disable these metrics explicitly. The following example demonstrates enabling the Click Stream metrics in a glue.conf
file:
glue {
metrics: {
click-stream: true
}
}
To disable completely the Click Stream metrics, set the click-stream
property to false
:
glue {
metrics: {
click-stream: false
}
}
By default, when the Click Stream metrics are enabled and the user clicks on an app component, its name will be recorded in the respective Click Stream metric. You can override this behavior by using the withClickStreamMetrics()
method when initializing the io.Connect Java library to provide a function for extracting the text from the clicked app component (including text from input fields):
// Function for extracting text from the clicked component.
public String getComponentText(Object object) {
if (object instanceof AbstractButton) {
return ((AbstractButton) object).getText();
} else if (object instanceof JEditorPane) {
return ((JEditorPane) object).getText();
} else if (object instanceof JLabel) {
return ((JLabel) object).getText();
} else {
return null;
}
}
Glue io = Glue.builder()
// Providing a function for extracting text.
.withClickStreamMetrics(getComponentText)
.build();
⚠️ Note that if there is no text in a selected component, its type isn't covered by the function, or you don't provide the
withClickStreamMetrics()
method when initializing the library, the name of the component will be recorded in the Click Stream metric.
If the Click Stream metrics are explicitly enabled in the library configuration file, passing null
as an argument to the withClickStreamMetrics()
method will enable the default behavior for recording the name of the clicked component. If no explicit settings are provided for Click Stream metrics in the library configuration file, passing null
as an argument to the withClickStreamMetrics()
method will disable the Click Stream metrics.
If the Click Stream metrics are explicitly disabled in the library configuration file, using the withClickStreamMetrics()
method in any way at runtime will have no effect.