Blog

Configuring Analytics via Mixpanel

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

var AppMixpanel = (function () {
  function _track(eventName, properties) {
    var mergedProperties = {};
    //get the hansel experience's data
    var hanselData = Hansel.logEvent(eventName, "mxp", properties);
    if(!properties) {properties = {};
    mergedProperties = Object.assign(properties, hanselData);

    mixpanel.track(eventName, mergedProperties);
  }

  return {
    track : _track
  };
})();

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
mixpanel.track(eventName, properties);

//it would get updated to
AppMixpanel.track(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 Mixpanel goal events will contain information related to the context charts created on Hansel dashboard.