Skip to main content

Events

Subscribe to events with the dedicated onXxx methods on storyManager. Each listener receives an event object whose payload is in event.body:

storyManager.onShowStory((event: any) => {
console.log('showStory', event.body);
});

Story reader events

MethodNative eventevent.body
onShowStoryshowStory{id: String, feed: String, action: String}
onCloseStorycloseStory{id: String, feed: String, index: Number, action: String}
onShowSlideshowSlide{id: String, index: Number}
onClickOnButtonclickOnButton{id: String, feed: String, index: Number, url: String}
onLikeStorylikeStory{id: String, feed: String, value: Boolean}
onDislikeStorydislikeStory{id: String, feed: String, value: Boolean}
onFavoriteStoryfavoriteStory{id: String, feed: String, value: Boolean}
onShareStoryclickOnShareStory{}
onStoryWidgetEventstoryWidgetEvent{id: String, feed: String, name: String, data: String}

Reader lifecycle events

MethodNative eventevent.body
onStoryReaderWillShowstoryReaderWillShow{type: String}
onStoryReaderDidClosestoryReaderDidClose{type: String}

Failure events

onFailure fires for every failure event below with the same listener:

storyManager.onFailure((event: any) => {
console.log('failure', event.body);
});
Native eventevent.body
sessionFailure{message: String}
storyFailure{message: String}
currentStoryFailure{message: String}
networkFailure{message: String}
requestFailure{message: String, statusCode: String}

Game events

onGameEvent fires for every game event with the same listener — see Games.

In-App Messaging events

onIamEvent fires for every IAM event with the same listener — see In-App Messaging.

Goods and product cart events

MethodNative eventevent.bodyDescription
onGoodItemSelectedgoodItemSelected{sku: String}User tapped a product in the goods widget
onProductCartClickedproductCartClicked{}User tapped the product cart widget
MethodNative eventevent.bodyDescription
onBannerWidgetEventbannerWidgetEvent{bannerData: Object, name: String, data: Object}Interactive widget event in banner

Logging events

Enable SDK internal logging and subscribe to log messages:

storyManager.setLoggingEnabled(true);

storyManager.onLog((entry: { level: 'debug' | 'error'; message?: string }) => {
console.log(`[IAS ${entry.level}] ${entry.message ?? ''}`);
});

Call to action

Button and deeplink clicks from readers, games, and banners are routed to storyLinkClickHandler. See Call To Action.

Unsubscribing (destroy)

All onXxx subscriptions are bound to the StoryManager instance. When replacing a manager (e.g. upon user logout/login), call destroy() to drop all active native subscriptions and prevent duplicate event callbacks:

// Clean up previous instance
oldStoryManager.destroy();

// Create new instance
const newStoryManager = await StoryManager.create(newConfig);