Skip to main content

Events

You can subscribe to events using InAppStoryManager instance

Example

import { InAppStoryManager } from "@inappstory/js-sdk";

const inAppStoryManager = new InAppStoryManager({ apiKey: "{projectToken}" });
inAppStoryManager.on("clickOnStory", (payload) => console.log(payload));


clickOnStory

Description: Triggered when a user clicks on a story card in the slider list.

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
extraFieldsobject?Custom attributes from the story payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.
indexnumberIndex of the story in the list.
isDeeplinkbooleanWhether the story was opened via deeplink.
urlstring?Deeplink URL.

showStory

Description: Triggered when a story is opened (from slider or reader).

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
extraFieldsobject?Custom attributes from the story payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.

closeStory

Description: Triggered when a story is closed.

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
extraFieldsobject?Custom attributes from the story payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.
actionstringClose action (closeReaderByCloseBtn, closeReaderByEscBtn, swipeDown, swipe, lastSlideClick, auto, externalCloseReader).

showSlide

Description: Triggered when a slide is shown.

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
extraFieldsobject?Custom attributes from the story payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.
indexnumberSlide index.
payloadstringSlide payload.

likeStory

Description: Triggered when a user likes/unlikes a story.

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
extraFieldsobject?Custom attributes from the story payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.
valuebooleantrue if liked, false if unliked.

dislikeStory

Description: Triggered when a user dislikes/undislikes a story.

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
extraFieldsobject?Custom attributes from the story payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.
valuebooleantrue if disliked, false if removed.

favoriteStory

Description: Triggered when a user adds/removes a story to favorites.

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
extraFieldsobject?Custom attributes from the story payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.
valuebooleantrue if favorited, false if removed.

shareStory

Description: Triggered when a user clicks on story sharing.

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
extraFieldsobject?Custom attributes from the story payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.

shareStoryWithPath

Description: Triggered after successful creation of the sharing path.

Payload:

FieldTypeDescription
idnumberStory ID.
titlestring?Story title.
slidesCountnumber?Number of slides in the story.
feedstring?Feed name where the story belongs.
sourcestring?Story source.
filterobjectApplied filters.
ugcPayloadobjectUGC-related payload.
extraFieldsobject?Custom attributes from the story payload.
defaultListLengthnumberDefault list length.
favoriteListLengthnumberFavorite list length.
urlstringGenerated sharing URL.

feedImpression

Description: Triggered after stories appear in the viewport.

Payload:

FieldTypeDescription
feedstringFeed name.
storiesarrayArray of stories { id: number; title: string; slidesCount: number; extraFields?: object }.

visibleAreaUpdated

Description: Triggered when the visible area of stories is updated in the viewport.

Payload:

FieldTypeDescription
feedstringFeed name.
storiesarrayArray of stories { id: number; title: string; slidesCount: number; extraFields?: object }.

widgetEvent

Description: Triggered by widgets inside a story.

Payload:

FieldTypeDescription
namestringWidget name.
dataanyWidget-specific data.
extraFieldsobject?Custom attributes from the story payload.

startGame

Description: Fired when a game starts.

Payload:

FieldTypeDescription
idstringUnique game ID

closeGame

Description: Fired when a game is closed.

Payload:

FieldTypeDescription
idstringID of the closed game

eventGame

Description: Fired when a custom game event occurs.

Payload:

FieldTypeDescription
namestringName of the event
payloadanyEvent-specific payload