Skip to main content

CoreEventDelegate

Callbacks from a core SDK session to your app.

Overview​

Implement CoreEventDelegate and pass it to configure(). trackImpression and trackAction are required; the other methods have defaults, so override only the ones you need. The What Just Happened callbacks fire only once a What Just Happened view is shown.

Syntax​

interface CoreEventDelegate {
fun trackImpression(analytics: Map<String, String>)
fun trackAction(analytics: Map<String, String>)
fun shouldShowPanel() {}
fun shouldHidePanel() {}
fun onPanelEvent(event: PanelEvent) {}
fun onWhatJustHappenedExplore(panelType: PanelTypeId) {}
fun shouldShowWhatJustHappened(moduleFact: WjhModuleFact): WhatJustHappenedDisplay = WhatJustHappenedDisplay.ShownWithFocus
}

Methods​

MethodDescription
trackImpression(analytics)Reports a user impression, as key-value pairs, for your analytics
trackAction(analytics)Reports a user action, as key-value pairs, for your analytics
shouldShowPanel()Asks your app to show the panel, for example after a viewer clicks an overlay that targets a panel
shouldHidePanel()Asks your app to hide the panel, for example when the viewer presses Back on the panel's tabs
onPanelEvent(event)Reports a panel event. A core session sends rendered:channels (RenderedChannels: the tab order and each listing's panels) whenever the panels it shows change.
onWhatJustHappenedExplore(panelType)Asks your app to open panelType after "Explore More" on the What Just Happened module
shouldShowWhatJustHappened(moduleFact)Decides how a new What Just Happened fact shows: Hidden, ShownWithFocus (default) or ShownWithoutFocus

Example​

class MyCoreDelegate : CoreEventDelegate {

override fun trackImpression(analytics: Map<String, String>) {
analyticsProvider.track("impression", analytics)
}

override fun trackAction(analytics: Map<String, String>) {
analyticsProvider.track("action", analytics)
}

override fun shouldShowPanel() {
panelVisible.value = true
}

override fun shouldHidePanel() {
panelVisible.value = false
}
}