Emitting Custom Metrics Using The QP API

The emitMetric function allows you to emit custom experience metrics.

INFO: You can track custom metrics in the same way as you track standard experience goals and custom goals.

Custom metrics are similar to custom goal events, except they aren't tracked relative to the control. In other words, it is an ideal way of tracking events that only happen as a result of the experience execution, e.g. recommendation.clicked or experience-widget.opened.

INFO: Custom metrics are saved in the BigQuery table event_qubit_metric.

The function takes three parameters:

  • type - the name of the metric being tracked
  • productId - optionally bind this metric to a particular productId
  • extra - optionally provide extra info in an object that can contain arbitrary information to describe the metric, e.g. product recommendations strategy

Please use the convention noun.verb for specifying type, e.g. recommendation.clicked.

options.emitMetric('recommendation.clicked', productId)

The API is included in the options object passed to the variation or triggers functions and can be called as shown above.

Any events sent through this are bound to the experience they are sent from.

Example:

options.emitMetric ('recommendation.shown', productId, {
  strategy: 'popular'
})
Last updated: May 2020
Did you find this article useful?