Ui Callbacks
Ui callbacks as sent on Users's Interaction with any of Nudge's Experiences. This Includes actions like Clicks, Seen and Dismiss.
In order to integrate Ui Callbacks follow these steps:
Add Callback Listener
Extend the class in which you want to Listen the Callback with NudgeGlobalCallback
and register the class for receiving the callback by passing the instance of the class to NudgeGlobalCallbackManager
's registerListener
method.
Now by overriding the onEvent
method you can listen to the callbacks
class YourClass : NudgeGlobalCallback {
init{
NudgeGlobalCallbackManager.registerListener(this)
}
override fun onEvent(event: NudgeCallback) {
when (event){
is NudgeUICallback -> {
when (event.action){
NCM.NUDGE_COMPONENT_CTA_CLICK.name->{
Log.d("CTA CLICK FROM NUDGE",event.data)
}
}
}
}
}
}
Callback Name and Data
Callback | Action | Data Structure |
---|---|---|
NUDGE_UI_CALLBACK | NUDGE_EXPERIENCE_OPEN | {CAMPAIGN_ID : string, CAMPAIGN_NAME : string, DISPLAY_NAME: string, DISPLAY_TYPE : string, DISPLAY_ID: string} |
NUDGE_EXPERIENCE_DISMISS | {CAMPAIGN_ID : string, CAMPAIGN_NAME : string, DISPLAY_NAME: string, DISPLAY_TYPE : string, DISPLAY_ID: string}} | |
NUDGE_EXPERIENCE_HIDDEN | { ... } | |
NUDGE_COMPONENT_CTA_CLICK | {TARGET: string, CAMPAIGN_ID: string, CAMPAIGN_NAME: string, WIDGET_NAME: string, WIDGET_ID: string, DISPLAY_NAME: string, CLICK_TYPE: string, DISPLAY_ID: string} |