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. This listener will provide two events given below:

  1. hansel_nudge_show_event - This event will be fired when a nudge is rendered on the device.
  2. hansel_nudge_event - This event will be fired when the nudge is dismissed.

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

class _PxInternalEventsListener extends PxInternalEventsListener {

  @override
  void onEvent(String eventName, Map dataFromHansel) {
    debugPrint('PXEvent: $eventName eventData : $dataFromHansel');
  }
}

Step 2 : Registering the listener with Product Experience SDK on app initialisation.

NetcorePX.instance.registerPxInternalEventsListener(_globalPxInternalEventsListener);

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 these two events.

hansel_nudge_show_event

  • interaction_map_name
  • nudge_name
  • nudge_type
  • app_id
  • user_id (fallback to device id if not present)

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