Implementing StorytellerDelegate Callbacks

A StorytellerDelegate has methods for managing Storyteller events. It is used as global object for handling all events when opening a Story Player with and without the StorytellerRowView or StorytellerGridView. Please see the dedicated StorytellerListViewDelegate for handling events related to rows and grids.

How to Use

To use global StorytellerDelegate, implement the StorytellerDelegate interface by overriding the required methods and set it in Storyteller object.


The onUserActivityOccurred(type: UserActivity.EventType, data: UserActivityData) method is is called when an analytics event is triggered. See the dedicated Analytics page for more information on analytic events.


The getAdsForList(stories: List<ClientStory>, onComplete: (AdResponse) -> Unit, onError: () -> Unit) method is called when the tenant is configured to request ads from the containing app and the SDK requires ad data from the containing app. For more information on how to supply ads to the Storyteller SDK, see the dedicated Ads page.


The userNavigatedToApp(url: String) method is called when a user taps on an action button on a Page which should direct the user to a specific place within the integrating app. For more information on deep linking, see the dedicated Deep Linking page.


    Storyteller.storytellerDelegate = myCustomStorytellerDelegate


The callback onUserActivityOccurred provides analytics events and corresponding data triggered internally by the SDK. This information can be used in your app.

The following parameters are passed to the callback method:

  • type - type of event that occurred, as a UserActivity.EventType enum
  • data - an object containing data about the event which occurred


    override fun onUserActivityOccurred(type: UserActivity.EventType, data: UserActivityData) {
        if (type == UserActivity.EventType.OPENED_STORY) {
            // Retrieve the story id value
            val openStoryId = data.storyId
            // Retrieve the story title value
            val openStoryTitle = data.storyTitle

            // Report retrieved values from your app

For a detailed discussion of all the relevant events and properties please see the dedicated Analytics page.

Client Ads

By implementing getAdsForList, you can provide custom ad data for the SDK to render, this is only applicable when the ad configuration is set to Integrating App in the CMS. Ad data can be obtained asynchronously, and should be provided using the onComplete closure parameter.


    override fun getAdsForList(stories: List<ClientStory>, onComplete: (AdResponse) -> Unit) {
        // Action to get some ads
        val ads = getMyAds()
        // Provide the ads to the SDK

For a detailed discussion of all the relevant considerations, please see the dedicated Ads page.

Swiping Up to the Integrating App

The callback userNavigatedToApp is called when a user taps on an action button on a page which has its link type set to In App. In this case, your app will be passed a URL which has been entered in the Storyteller CMS and your app is then responsible for parsing this URL and following it to the correct location within your app.


    override fun userNavigatedToApp(url: String) {
        // parse the url and navigate to the destination
Forward Arrow