Configuring Analytics via Amplitude

Step 1: Create a new service "AppAmplitude" and add the following method to it.

var AppAmplitude = (function () {
  function _logEvent(eventName, properties) {
    var mergedProperties = {};
    var hanselData = Hansel.logEvent(eventName, "amp", properties);
    if(!properties) {properties = {};}
    mergedProperties = Object.assign(properties, hanselData);

    amplitude.getInstance().logEvent(eventName, mergedProperties);
  }

  return {
    logEvent : _logEvent
  };
})();

Step 2: For all those events on which you want to track the impact of Hansel changes, make the updates as suggested in the snippet below:

//If the original code was
amplitude.getInstance().logEvent(eventName, properties');

//it would get updated to
AppAmplitude.logEvent(eventName, properties);

Step 3: Fire events from Test device:

Ensure that you fire the events which you added in Steps 1 and 2, from a test device. This can be done by invoking all the flows within the website, where the events have been added.

Once you have done the above changes, selected Amplitude goal events will contain information related to the context charts created on Hansel dashboard.