Smartech

Send nudge events to your own analytics system

Please follow the below steps if you wish to get nudge events shared back to your own analytics system.

Step 1 : Create a class that implements the HanselInternalEventsListener with the following method:

import io.hansel.ujmtracker.HanselInternalEventsListener;

HanselInternalEventsListener hanselInternalEventsListener = new HanselInternalEventsListener() {
   @Override
   public void onEvent(String eventName, HashMap dataFromHansel) {
        if ("hansel_nudge_event".equals(eventName)){
            // send `dataFromHansel` to your analytics provider 
            // e.g. CleverTap.push(clevertapAPI, "hansel_nudge_event", dataFromHansel);
        }
    }
};
import io.hansel.ujmtracker.HanselInternalEventsListener

var hanselInternalEventsListener : HanselInternalEventsListener = object : HanselInternalEventsListener() {
  fun onEvent(eventName:String, dataFromHansel:HashMap<String, Any>) {
    
    //Fire this hansel event using your analytics vendor as explained in the above section (Handling existing app events)
    
    //e.g. AppCleverTap.push(clevertapAPI, eventName, properties)
    
    //In case your app is using multiple analytics vendors, then please fire the hansel events with only one vendor
  }
}

Step 2 : Registering the listener with Product Experience SDK

import io.hansel.ujmtracker.HanselTracker;

//Register the listener with Hansel SDK by using this code.
HanselTracker.registerListener(hanselInternalEventsListener);
import io.hansel.ujmtracker.HanselTracker

//Register the listener with Hansel SDK by using this code.
HanselTracker.registerListener(hanselInternalEventsListener)

Note

  1. Please ensure to select the checkbox 'Send nudges to Analytics Provider' from Step 2 of Nudge creation flow.
  1. Below are properties that you can expect in 'hansel_nudge_event'
  • interaction_map_name
  • nudge_name
  • nudge_type
  • app_id
  • user_id (fallback to device id if not present)
  • nudge_rating : NULL | Rating | NPS (will be a number)
  • nudge_mcq : MCQ (will be a string)
  • nudge_inputtext: NULL | text
  • nudge_action: button1/2_clicked | buttontext | close_clicked | noaction_autodismissed | noaction_screenchanged | noaction_appclosed | backdrop_dismissed

Updated about a month ago


Send nudge events to your own analytics system


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.