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 Method

Create a method called hanselEventsListener

function hanselEventsListener(eventName, eventData) {
	/**
	 * Use this function to send `eventData` to you third party Analytics Vendor
	 * e.g. amplitude.getInstance().logEvent(eventName, eventData);
	 */
}

🚧

Handling Hansel events

In case your app is using multiple analytics vendors, then please fire these events with only one vendor.

Step 2: Register Method

Register this HanselEventsListener with the Hansel SDK using the following code. Please register the listener immediately after you initialize your third party analytics vendor.

Hansel.registerListener(hanselEventsListener);

Note

  1. Please ensure to select the checkbox 'Send nudges to Analytics Provider' from Step 3 of Product Experience 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