This page lists the enums, data types, theme classes, and server rendering helpers that the SDK exports. Theme properties are covered in Customize themes, and event properties in the analytics event pages.
Every enum value is a string equal to its member name. In TypeScript, pass the enum member, such as Storyteller.UiStyle.dark. In JavaScript, you can also pass the string, such as 'dark'.
Selects the light or dark theme of a UiTheme. auto follows the system color scheme. Set it with configuration.uiStyle or the data-ui-style container attribute. See uiStyle.
The source groups these values as no longer used or deprecated:
completedPage and skippedPage. The Story player still records these two events, and the event pages do not document them
swipedUp, viewedPage, completedAd, swipedUpOnAd, previousAd, impression, readyToPlay, mediaStarted, bufferingStarted, bufferingEnded. The SDK does not record these events
The items of eventTrackingOptions.disabledFunctionalFeatures. all disables every item. See Disabled functional features.
Note
The npm package exports this enum at runtime. The CDN script does not, so Storyteller.StorytellerTrackedFunctionalFeature is undefined there. Pass the string values instead, such as ['pageReadStatus'].
Holds a light and a darkTheme. The constructor builds both from baseTheme, and unset properties keep their defaults. The view's UiStyle decides which theme applies. See Customize themes.
Exported as Theme. One color scheme of a theme. The constructor copies the properties of theme over the defaults. The SDK sets isDark when it builds the dark theme. toPlainObject returns the instance.
A singleton instance. getStories loads the Stories of the given categories with the API key from initialize, and keeps the Stories that have a Google Web Story URL. render returns a hidden <amp-story-player> element with a link, poster image, and title for each Story. No task guide covers these methods.
The SDK also exports these names. No guide covers them, and integrations do not need them:
Export
Kind
Notes
Story
Class
Story data model from the Stories API. No public SDK method or callback returns it in 11.0.0
QuizRenderer
Instance
Renders Quiz questions and results inside a Story page document. The SDK's Story page script uses its own copy
QuizApiService
Instance
Loads Quiz data for Story pages. The SDK's Story page script uses its own copy
{"slug": "reference-types", "page_title": "Types and Enums", "page_url": "reference/types/", "canonical_url": "/web/reference/types/", "markdown": "# Types and enums\n\nThis page lists the enums, data types, theme classes, and server rendering helpers that the SDK exports. Theme properties are covered in [Customize themes](../Themes.md), and event properties in the [analytics event pages](../Analytics.md#event-types).\n\n## Enums\n\nEvery enum value is a string equal to its member name. In TypeScript, pass the enum member, such as `Storyteller.UiStyle.dark`. In JavaScript, you can also pass the string, such as `'dark'`.\n\n### `UiStyle`\n\n```typescript\nenum UiStyle {\n auto = 'auto',\n light = 'light',\n dark = 'dark',\n}\n```\n\nSelects the `light` or `dark` theme of a [`UiTheme`](#uitheme). `auto` follows the system color scheme. Set it with [`configuration.uiStyle`](views.md#ilistconfiguration) or the `data-ui-style` container attribute. See [uiStyle](../StorytellerListView.md#uistyle).\n\n### `CellType`\n\n```typescript\nenum StorytellerListViewCellType {\n round = 'round',\n square = 'square',\n}\n```\n\nExported as `CellType`. Sets the tile shape of a row. The default is `square`. See [cellType](../StorytellerRowView.md#celltype).\n\n### `ActivityType`\n\nThe `type` argument of [`onUserActivityOccurred`](callbacks.md#onuseractivityoccurred). The event pages list when each event fires and its properties:\n\n| Area | Values | Reference |\n| --- | --- | --- |\n| SDK | `sdkInitialized` | [SDK initialization](../Analytics.md#sdk-initialization) |\n| Stories and Clips | `actionButtonTapped`, `shareButtonTapped`, `shareSuccess` | [Story events](../analytics/StoryEvents.md), [Clip events](../analytics/ClipEvents.md) |\n| Stories | `openedStory`, `dismissedStory`, `skippedStory`, `completedStory`, `openedPage`, `previousPage`, `previousStory` | [Story events](../analytics/StoryEvents.md) |\n| Story captions | `enabledStoryCaptions`, `disabledStoryCaptions` | [Story caption events](../analytics/StoryEvents.md#caption-state-and-events) |\n| Polls | `votedPoll` | [Poll events](../analytics/PollEvents.md) |\n| Quizzes | `triviaQuizQuestionAnswered`, `triviaQuizCompleted` | [Quiz events](../analytics/QuizEvents.md) |\n| Ads | `openedAd`, `dismissedAd`, `pausedAdPage`, `resumedAdPage`, `finishedAd`, `skippedAd`, `adActionButtonTapped`, `viewedAdPageFirstQuartile`, `viewedAdPageMidpoint`, `viewedAdPageThirdQuartile`, `viewedAdPageComplete` | [Ad events](../analytics/AdEvents.md) |\n| Clips | `openedClip`, `dismissedClip`, `finishedClip`, `nextClip`, `previousClip`, `completedLoop`, `pausedClip`, `resumedClip`, `likedClip`, `unlikedClip`, `openedCategory`, `dismissedCategory` | [Clip events](../analytics/ClipEvents.md) |\n| Clip captions | `enabledClipCaptions`, `disabledClipCaptions` | [Clip caption events](../analytics/ClipEvents.md#caption-state-and-events) |\n\nThe source groups these values as no longer used or deprecated:\n\n- `completedPage` and `skippedPage`. The Story player still records these two events, and the event pages do not document them\n- `swipedUp`, `viewedPage`, `completedAd`, `swipedUpOnAd`, `previousAd`, `impression`, `readyToPlay`, `mediaStarted`, `bufferingStarted`, `bufferingEnded`. The SDK does not record these events\n\n### `OpenedReason`\n\nThe `openedReason` property of open events:\n\n| Area | Values |\n| --- | --- |\n| Stories | `storyListTap`, `deepLink`, `swipe`, `automaticPlayback`, `tap` |\n| Clips | `clipListTap`, `categoryListTap`, `categoryBackTap`, `deepLink` |\n\nSee [OpenedReason](../Analytics.md#openedreason) for each value. [`openCollection`](storyteller.md#opencollection) accepts `OpenedReason.deepLink` as its third argument.\n\n### `DismissedReason`\n\nThe `dismissedReason` property of dismiss events:\n\n| Area | Values |\n| --- | --- |\n| Stories and Clips | `backgroundTapped`, `instanceMethod`, `windowUnload` |\n| Stories | `closeButtonTapped`, `swipedDown`, `swipedFirstStory`, `swipedFinalStory`, `skippedFinalPage`, `completedFinalPage`, `backTapped`, `escapeKeyPressed` |\n| Clips | `backButtonTapped` |\n\nSee [DismissedReason](../Analytics.md#dismissedreason) for each value. [`dismissPlayer`](storyteller.md#dismissplayer) reports `instanceMethod`.\n\n### `StorytellerTrackedFunctionalFeature`\n\n```typescript\nenum StorytellerTrackedFunctionalFeature {\n all = 'all',\n clipLikes = 'clipLikes',\n clipShares = 'clipShares',\n clipViewedStatus = 'clipViewedStatus',\n pageReadStatus = 'pageReadStatus',\n pollVotes = 'pollVotes',\n triviaQuizAnswers = 'triviaQuizAnswers',\n}\n```\n\nThe items of `eventTrackingOptions.disabledFunctionalFeatures`. `all` disables every item. See [Disabled functional features](../PrivacyAndTracking.md#disabled-functional-features).\n\n!!! note\n\n The npm package exports this enum at runtime. The CDN script does not, so `Storyteller.StorytellerTrackedFunctionalFeature` is `undefined` there. Pass the string values instead, such as `['pageReadStatus']`.\n\n### Theme enums\n\nThree enums set theme properties. See [Customize themes](../Themes.md) for each property:\n\n| Enum | Values | Theme properties |\n| --- | --- | --- |\n| `Alignment` | `start`, `center`, `end` | [`storyTiles.title.alignment`, `storyTiles.rectangularTile.chip.alignment`](../Themes.md#story-tiles) |\n| `ButtonAlignment` | `left`, `center`, `right` | [`player.actionButton.alignment`](../Themes.md#player) |\n| `TextCase` | `default`, `upper`, `lower` | [`buttons.textCase`](../Themes.md#buttons) |\n\n## Privacy options\n\nThe type of [`Storyteller.sharedInstance.eventTrackingOptions`](storyteller.md#eventtrackingoptions).\n\n### `StorytellerEventTrackingOptions`\n\n```typescript\ntype StorytellerEventTrackingOptions = {\n disabledFunctionalFeatures: StorytellerTrackedFunctionalFeature[];\n enableAdTracking: boolean;\n enableFullVideoAnalytics: boolean;\n enableFunctionalCookies: boolean;\n enablePersonalization: boolean;\n enableRemoteViewingStore: boolean;\n enableStorytellerTracking: boolean;\n enableUserActivityTracking: boolean;\n};\n```\n\n| Field | Default | Effect when changed from the default |\n| --- | --- | --- |\n| [`disabledFunctionalFeatures`](../PrivacyAndTracking.md#disabled-functional-features) | `[]` | Stops tracking the listed features |\n| [`enableAdTracking`](../PrivacyAndTracking.md#ad-tracking) | `true` | `false` stops ad events and removes Story and Clip details from ad requests |\n| [`enableFullVideoAnalytics`](../PrivacyAndTracking.md#full-video-analytics) | `true` | `false` sets Story, Page, and Clip IDs and titles to `null` in callback data |\n| [`enableFunctionalCookies`](../PrivacyAndTracking.md#functional-cookies-and-local-storage-items) | `true` | `false` stops non-essential local storage, and turns off personalization and Storyteller tracking |\n| [`enablePersonalization`](../PrivacyAndTracking.md#user-personalization) | `true` | `false` stops sending user IDs and user attributes for personalization |\n| [`enableRemoteViewingStore`](../PrivacyAndTracking.md#remote-viewing-store) | `true` | `false` keeps user IDs off backend services and keeps viewing activity on the device |\n| [`enableStorytellerTracking`](../PrivacyAndTracking.md#storyteller-tracking) | `true` | `false` stops storing analytics events on Storyteller servers |\n| [`enableUserActivityTracking`](../PrivacyAndTracking.md#user-activity-tracking) | `true` | `false` stops `onUserActivityOccurred` calls |\n\n## Event data\n\nThe data types of analytics events.\n\n### `UserActivityData`\n\nThe `data` argument of [`onUserActivityOccurred`](callbacks.md#onuseractivityoccurred). Every field is optional, and each event sets a subset. The event pages list the fields of each event.\n\n| Area | Fields and types |\n| --- | --- |\n| Context | `context` (`unknown`): the view's [`configuration.context`](../Analytics.md#context) |\n| Stories and Pages | `storyId`, `storyTitle`, `storyDisplayTitle`, `pageId`, `pageTitle` (`string`, or `null` when `enableFullVideoAnalytics` is `false`); `storyIndex`, `storyPageCount`, `pageIndex`, `durationViewed`, `pagesViewed`, `contentLength` (`number`); `storyReadStatus` (`string`); `storyPlaybackMode` (`'list'` or `'singleStory'`); `pageType` (`'image'`, `'video'`, `'poll'`, or `'triviaQuiz'`); `pageHasAction` (`boolean`); `pageActionText`, `pageActionUrl` (`string` or `null`) |\n| Navigation | `openedReason` ([`OpenedReason`](#openedreason)); `dismissedReason` ([`DismissedReason`](#dismissedreason)); `shareMethod` (`'share'`, `'shareMedia'`, `'shareLink'`, or `''`) |\n| Categories | `categories` (`string[]`); `categoryDetails` (`CategoryDetail[]`); `currentCategory` (`CurrentCategory`); `categoryId`, `categoryName` (`string`) |\n| Ads | `adId`, `adStrategy` (`string`); `advertiserName` (`string` or `null`); `adType` (`'stories'` or `'clips'`); `adPlacement` (`'betweenClips'`, `'betweenStories'`, `'betweenStoriesAndPages'`, or `'betweenPages'`) |\n| Polls | `pollAnswerId` (`string`) |\n| Quizzes | `triviaQuizId`, `triviaQuizQuestionId`, `triviaQuizAnswerId`, `triviaQuizTitle` (`string`); `triviaQuizScore` (`number`) |\n| Clips | `clipId`, `clipTitle` (`string`, or `null` when `enableFullVideoAnalytics` is `false`); `collection` (`string`); `clipActionText`, `clipActionUrl` (`string` or `null`); `clipIndex`, `clipsViewed`, `loopsViewed` (`number`); `clipHasAction` (`boolean`) |\n| Captions | `captionsEnabled` (`boolean`) |\n| SDK initialization | `initializationSucceeded`, `enableAdTracking`, `enableFullVideoAnalytics`, `enablePersonalization`, `enableRemoteViewingStore`, `enableStorytellerTracking`, `enableUserActivityTracking` (`boolean`); `appId`, `screenResolution` (`string` or `null`); `deviceBrand`, `deviceModel`, `operatingSystem`, `osVersion` (`string`); `deviceType` (`'Phone'`, `'Tablet'`, `'TV'`, or `'Desktop'`) |\n\nThe category types have these fields:\n\n```typescript\nclass CategoryDetail {\n name: string;\n id?: string;\n type: string;\n placement?: string;\n externalId?: string;\n}\n\nclass CurrentCategory {\n title: string;\n id?: string;\n placement?: string;\n}\n```\n\nThe SDK exports `UserActivityData` as a class. The callback receives a plain object with these fields.\n\n### `ActivityEventDetail`\n\n```typescript\nclass ActivityEventDetail {\n type: ActivityType;\n data: UserActivityData;\n constructor(type: ActivityType, data: UserActivityData);\n}\n```\n\nA pair of event type and event data. The SDK exports the class, but no SDK callback receives it in 11.0.0.\n\n## Ad request data\n\nThe `adRequestInfo` argument of [`getAdConfig`](callbacks.md#getadconfig). See [AdRequestInfo](../Ads.md#adrequestinfo).\n\n### `StorytellerAdRequestInfo`\n\n```typescript\ntype StorytellerAdRequestInfo =\n | StorytellerStoriesAdRequestInfo\n | StorytellerClipsAdRequestInfo;\n```\n\nCheck for the `story` field to tell the variants apart:\n\n```typescript\nconst isStoryAd = (\n info: Storyteller.StorytellerAdRequestInfo\n): info is Storyteller.StorytellerStoriesAdRequestInfo => 'story' in info;\n```\n\n### `StorytellerStoriesAdRequestInfo`\n\n```typescript\ntype StorytellerStoriesAdRequestInfo = {\n placement: string;\n categories: string[];\n story: {\n id: '';\n categories: CategoryDetail[];\n };\n};\n```\n\n| Field | Description |\n| --- | --- |\n| `placement` | Placement code of the Story category that matches the first category ID of the view. `''` when none matches |\n| `categories` | Category IDs of the view that shows the Story |\n| `story.categories` | Categories of the Story, as [`CategoryDetail`](#useractivitydata) objects |\n| `story.id` | Always `''`. Deprecated |\n\nSee [Stories AdRequestInfo](../Ads.md#stories-adrequestinfo).\n\n### `StorytellerClipsAdRequestInfo`\n\n```typescript\ntype StorytellerClipsAdRequestInfo = {\n collection: string;\n clip: {\n id: '';\n categories: ClipCategory[];\n };\n nextClip?: {\n categories: ClipCategory[];\n };\n};\n```\n\n| Field | Description |\n| --- | --- |\n| `collection` | Collection ID |\n| `clip.categories` | Categories of the current Clip |\n| `nextClip.categories` | Categories of the next Clip. `nextClip` is absent when no next Clip exists |\n| `clip.id` | Always `''`. Deprecated |\n\n`ClipCategory` has these fields:\n\n```typescript\ninterface ClipCategory {\n id: string;\n name: string;\n externalId: string;\n placement: string | null;\n type: string;\n displayTitle: string;\n availableForNavigation: boolean;\n}\n```\n\nSee [Clips AdRequestInfo](../Ads.md#clips-adrequestinfo).\n\n## Theme classes\n\nThe classes and types that build a theme. [Customize themes](../Themes.md) lists every theme property and default.\n\n### `UiTheme`\n\n```typescript\nclass UiTheme implements IUiTheme {\n light: StorytellerTheme;\n dark: StorytellerTheme;\n constructor(baseTheme?: Subset<IUiTheme> | null);\n}\n```\n\nHolds a `light` and a `dark` [`Theme`](#theme). The constructor builds both from `baseTheme`, and unset properties keep their defaults. The view's [`UiStyle`](#uistyle) decides which theme applies. See [Customize themes](../Themes.md#configuring-a-uitheme).\n\n```typescript\nconst theme = new Storyteller.UiTheme({\n light: { colors: { primary: '#1C62EB' } },\n dark: { colors: { primary: '#6699FF' } },\n});\n```\n\n### `Theme`\n\n```typescript\nclass StorytellerTheme implements IStorytellerTheme {\n colors: StorytellerColorsTheme;\n font: string;\n primitives: StorytellerPrimitivesTheme;\n lists: StorytellerListsTheme;\n storyTiles: StorytellerTilesTheme;\n player: StorytellerPlayerTheme;\n clipPlayer: StorytellerClipPlayerTheme;\n buttons: StorytellerButtonsTheme;\n instructions: StorytellerInstructionsTheme;\n engagementUnits: StorytellerEngagementUnitsTheme;\n isDark: boolean;\n constructor(theme?: Subset<IStorytellerTheme>);\n toPlainObject(): this;\n}\n```\n\nExported as `Theme`. One color scheme of a theme. The constructor copies the properties of `theme` over the defaults. The SDK sets `isDark` when it builds the dark theme. `toPlainObject` returns the instance.\n\n| Property | Theme section |\n| --- | --- |\n| `colors` | [Colors](../Themes.md#colors) |\n| `font` | [Font](../Themes.md#font) |\n| `primitives` | [Primitives](../Themes.md#primitives) |\n| `lists` | [Lists](../Themes.md#lists) |\n| `storyTiles` | [Story Tiles](../Themes.md#story-tiles) |\n| `player` | [Player](../Themes.md#player) |\n| `clipPlayer` | [Clips player](../Themes.md#clip-player) |\n| `buttons` | [Buttons](../Themes.md#buttons) |\n| `instructions` | [Instructions](../Themes.md#instructions) |\n| `engagementUnits` | [Polls and Quizzes theme](../Themes.md#engagement-units) |\n\n### `Subset`\n\n```typescript\ntype Subset<K> = {\n [attr in keyof K]?: K[attr] extends object\n ? Subset<K[attr]>\n : K[attr] extends object | null\n ? Subset<K[attr]> | null\n : K[attr] extends object | null | undefined\n ? Subset<K[attr]> | null | undefined\n : K[attr];\n};\n```\n\nA recursive `Partial`. Theme inputs use it, so you set only the properties that you change, at any depth.\n\n```typescript\nconst rowTheme: Storyteller.Subset<Storyteller.UiTheme> = {\n light: { lists: { row: { startInset: 0 } } },\n};\n```\n\n## Server rendering\n\nThese exports build Story markup for server-side rendering. They do not use `window` or `document`.\n\n### `ServerRenderer`\n\n```typescript\nServerRenderer.getStories(categories?: string[]): Promise<ServerRenderedStory[]>\nServerRenderer.render(stories: ServerRenderedStory[]): React.JSX.Element\n```\n\nA singleton instance. `getStories` loads the Stories of the given categories with the API key from `initialize`, and keeps the Stories that have a Google Web Story URL. `render` returns a hidden `<amp-story-player>` element with a link, poster image, and title for each Story. No task guide covers these methods.\n\n| Parameter | Type | Required | Default | Description |\n| --- | --- | --- | --- | --- |\n| `categories` | `string[]` | No | `[]` | Story category IDs |\n| `stories` | `ServerRenderedStory[]` | Yes | None | Stories from `getStories` |\n\n### `ServerRenderedStory`\n\n```typescript\ntype ServerRenderedStory = {\n id: string;\n href: string;\n title: string;\n thumbnailUrl: string;\n};\n```\n\n`href` is the Story's Google Web Story URL.\n\n## Other exports\n\nThe SDK also exports these names. No guide covers them, and integrations do not need them:\n\n| Export | Kind | Notes |\n| --- | --- | --- |\n| `Story` | Class | Story data model from the Stories API. No public SDK method or callback returns it in 11.0.0 |\n| `QuizRenderer` | Instance | Renders Quiz questions and results inside a Story page document. The SDK's Story page script uses its own copy |\n| `QuizApiService` | Instance | Loads Quiz data for Story pages. The SDK's Story page script uses its own copy |\n", "copy_markdown_include_header": false, "base_path": "", "ai_dir": "ai", "missing_payload_behavior": "empty"}