Implementing StorytellerDelegate Callbacks#
The StorytellerDelegate interface provides methods for managing Storyteller events. It serves as the global object for handling events within both StorytellerStoriesRowView and StorytellerStoriesGridView players. Refer to the dedicated StorytellerListViewDelegate page for details on handling events related to rows and grids.
How to Use#
To define delegate methods, set the delegate property on a shared Storyteller instance:
Storyteller.sharedInstance.delegate = {
// Your delegate methods here
};
Methods#
You can implement these optional methods when responding to the StorytellerDelegate protocol:
onUserActivityOccurred: (type: ActivityType, data: UserActivityData) => void- Called when an analytics event is triggered. Refer to the dedicated Analytics page for more information on analytic events.onShareButtonTapped: (text: string, title: string, url: string) => Promise<void>- Called when the user clicks the share button on a Story Page. This method can be used to override the default share behaviorgetAdConfig: () => AdConfig | null- Implement this to display ads in the Stories on your site. More information can be found on the Ads PageuserNavigatedToApp: (url: string) => void- Implement this to handle routing forinAppactions. If this method isn't specified,inAppactions will open like regular URLs.
interface IStorytellerDelegate {
onUserActivityOccurred?: (type: ActivityType, data: UserActivityData) => void;
onShareButtonTapped?: (
text: string,
title: string,
url: string
) => Promise<void>;
getAdConfig?: () => AdConfig | null;
userNavigatedToApp?: (url: string) => void;
}