Use this guide to update a Web SDK 10.13.x integration to 11.0.0. Version 11
keeps the 10.13 entry points, so most integration code does not change. It
also has breaking changes. Read Breaking changes and
make the changes that apply to you before you deploy version 11.
When enableFunctionalCookies and enableRemoteViewingStore are true (the
defaults), initialize requests the current user's viewing history from Storyteller and
waits for it. The history covers read Pages, Clip likes and views, and Poll
and Quiz answers. History for an externalId follows the user across
browsers and devices.
Read state from 10.13 carries over. With the default privacy options, 10.13
sent each opened Page, Poll vote, Quiz answer, and Clip like to Storyteller
under the user ID stored in Storyteller.user. Version 11 keeps that user ID
and loads the same history, so Stories that users read in 10.13 still show
as read. Read state does not carry over when 10.13 ran with
enableFunctionalCookies: false or enableRemoteViewingStore: false; see
Local storage keys changed.
enablePersonalization: false does not stop this request. The request sends
the user ID but no user attributes, as 10.13 activity events already did.
If this request fails, initialize rejects with InvalidApiKeyError,
NetworkError, or NetworkTimeoutError, and the SDK does not send the
sdkInitialized event.
Version 11 uses new local storage keys for viewing history. It does not read
the 10.13 keys and does not remove them.
10.13 key
11.0 key
Storyteller.clipLikes
Storyteller.likes
Storyteller.clipsViewed
Storyteller.viewedClips
Storyteller.pollAnswerMap
Storyteller.pollAnswers
Storyteller.quizAnswerMap
Storyteller.triviaQuizAnswers
Storyteller.storiesReadMap
Storyteller.readPages
With the default enableRemoteViewingStore: true, the SDK keeps viewing
history in Storyteller, not in local storage. With
enableRemoteViewingStore: false, the SDK keeps viewing history only in the
new local storage keys. Read Pages, likes, and answers that 10.13 saved do not
carry over, so Stories that users read in 10.13 show as unread.
To update:
Replace the 10.13 key names in your cookie or consent inventory. The
local storage table
lists every current key.
If your consent policy requires it, remove the five 10.13 keys yourself.
The script build now downloads Story player, Clips player, Poll, Quiz, and
caption code as separate files the first time a page needs them. It loads
them from the directory that served storyteller.min.js. The Storyteller CDN
serves every file. The npm package is not affected.
If you host the SDK files yourself:
Copy every file in the version's dist directory to one directory on your
server.
Keep the file names.
Load storyteller.min.js from its own <script> tag. Do not rename,
bundle, or inline it.
If your page has a Content Security Policy, its script-src must allow the
directory that serves the SDK files, on the CDN or on your server. A policy
that allows only a nonce or a hash for the main script also needs
'strict-dynamic' or the SDK host.
The npm package now declares these peer dependencies, because its TypeScript
declarations import them:
@types/react: >=17 <20
@types/react-router-dom: ^5.1.7
npm 7 and later installs them. If npm install reports a peer dependency
conflict, change your @types/react version to one in that range. See
TypeScript declarations.
The package also adds import and require entry points and publishes its
declarations at dist/index.npm.d.ts. It no longer ships index.js,
types/*.d.ts, or SDK source files. Import only these paths:
A default import resolves only in ES module builds. In CommonJS builds,
including Jest, use import * as Storyteller or require. Version 10.13
behaved the same way.
The SDK no longer installs the reflect-metadata polyfill on the page's
global Reflect object. If your code calls Reflect.getMetadata or
Reflect.defineMetadata, import reflect-metadata in your application.
ActivityType has a new sdkInitialized
member. Update exhaustive switch statements over ActivityType.
Story has new pinnedChipText and customLiveChipText properties. Add
them to typed test data.
The undocumented QuizRenderer.clearQuizData() method was removed. Remove
any calls to it.
These changes need no code, but check them in your application:
Player code loads on demand (script tag only): the script build
downloads Story player, Clips player, Poll, Quiz, and caption code the first
time a page needs it. The npm package still includes this code, and your
bundler decides how it loads.
AMP player preload: each Stories row or grid starts a low-priority
download of the AMP player script before the first Story opens. Set
preload to true to prepare more of
the Story player in advance.
Story ordering: when the Stories API uses
started-aware ordering, rows
and grids show Stories the user has not opened, then Stories in progress,
then finished Stories. Pinned and Live Stories keep their priority.
Clips paging: Clips rows, grids, and players that show a Collection
load more Clips as the user
reaches the last loaded Clip. The
onDataLoadComplete callback reports
the number of Clips in the first page as dataCount. Later pages load
without delegate callbacks.
Clip details: the Clips player can show a
long description in an expandable
details area.
Compact Clip action buttons: if your remote theme sets
clipsActionButtonCompactSize,
the Clips player shows smaller action buttons.
Like and share counts: if your remote theme sets
showLikeCount or showShareCount to false,
the Clips player hides that count.
Caption defaults: each caption theme
field set for a feed now overrides only that field of the tenant caption
theme. Default captions use 16 px text, the font's natural line height, and
a #171A25 background instead of 18 px text, a 22 px line height, and a
#000000 background.
Stories with no Pages: rows and grids no longer show them.
sdkInitialized event: onUserActivityOccurred receives
sdkInitialized during initialize.
If your handler maps every event type, make it ignore or record this one.
Use the fixed URL in production. This keeps later releases from changing the
SDK without an application deployment.
Earlier guides showed a /javascript-sdk/latest/ URL. That path does not
serve production releases. Replace it with a fixed version URL, such as the
one above.
Initialize the SDK with a test tenant. Check that initialize resolves.
With the default privacy options, also check that the viewing-history
request succeeds in the browser's network panel.
Load every row, grid, and embedded player your application uses. Check
Story ordering and later Clips pages where your tenant enables them.
Open and close Story and Clips players. Check long Clip descriptions,
custom Story chips, compact Clip action buttons, like and share counts,
captions, and long Poll and Quiz answers where you use them.
Read a Story, reload the page, and check that the Story still shows as
read. Repeat the check after you change between anonymous and signed-in
users, if your application supports both.
If you host the SDK files, open a Story, a Clips player, a Poll, and a
Quiz. Check that each player, Poll, Quiz, and caption file loads from your
server with no 404 errors.
Open each player and check the browser console for Content Security Policy
errors.
Confirm privacy settings, analytics callbacks, and ad requests. Check the
sdkInitialized event if your application handles activity events.
Change routes in a single-page application. Check that your code calls
destroy() before it removes a view's
container, and that a new view appears when the route returns.
Review the release notes for other changes that apply to
your integration.
Restore the previous fixed npm version or CDN URL, then rebuild and deploy the
application. If you host the SDK files, restore the 10.13 files too. Keep the
previous version number in the release record until the version 11 checks
pass.
Version 10.13 does not read the local storage keys that version 11 uses.
{"slug": "getting-started-migrate-to-11", "page_title": "Migrate from Version 10 to 11", "page_url": "getting-started/migrate-to-11/", "canonical_url": "/web/getting-started/migrate-to-11/", "markdown": "# Migrate from version 10 to 11\n\nUse this guide to update a Web SDK 10.13.x integration to 11.0.0. Version 11\nkeeps the 10.13 entry points, so most integration code does not change. It\nalso has breaking changes. Read [Breaking changes](#breaking-changes) and\nmake the changes that apply to you before you deploy version 11.\n\n## Before you update {#record-the-current-integration}\n\nRecord the current integration, so you can test the update and roll it back:\n\n- the current SDK version\n- the installation path: npm or script tag\n- where the SDK files are hosted, if you host them yourself\n- `initialize` options and how you set and change users\n- each view constructor and its configuration\n- privacy, analytics, callback, and ad settings\n- any proxy, allowlist, or Content Security Policy between the browser and\n Storyteller\n\nRead the current version from the SDK.\n\n```javascript\nconsole.log(Storyteller.sharedInstance.version);\n```\n\n## What stays the same {#keep-the-public-entry-points}\n\nVersion 11 keeps these entry points:\n\n- the `@getstoryteller/storyteller-sdk-javascript` package name\n- the `Storyteller` browser global\n- `Storyteller.sharedInstance.initialize`\n- the Story and Clip view constructor names\n- the npm stylesheet, `dist/storyteller.min.css`\n\nNamespace and named imports keep working, and the package includes\nTypeScript declarations.\n\n## Breaking changes\n\nEach change below says what to do. Some changes apply only to certain\nintegrations, such as self-hosted SDK files or TypeScript code.\n\n### Viewing history loads from Storyteller {#viewing-history-loads-from-storyteller}\n\nWhen `enableFunctionalCookies` and `enableRemoteViewingStore` are `true` (the\ndefaults), `initialize` requests the current user's viewing history from Storyteller and\nwaits for it. The history covers read Pages, Clip likes and views, and Poll\nand Quiz answers. History for an `externalId` follows the user across\nbrowsers and devices.\n\nRead state from 10.13 carries over. With the default privacy options, 10.13\nsent each opened Page, Poll vote, Quiz answer, and Clip like to Storyteller\nunder the user ID stored in `Storyteller.user`. Version 11 keeps that user ID\nand loads the same history, so Stories that users read in 10.13 still show\nas read. Read state does not carry over when 10.13 ran with\n`enableFunctionalCookies: false` or `enableRemoteViewingStore: false`; see\n[Local storage keys changed](#local-storage-keys-changed).\n\n`enablePersonalization: false` does not stop this request. The request sends\nthe user ID but no user attributes, as 10.13 activity events already did.\n\nIf this request fails, `initialize` rejects with `InvalidApiKeyError`,\n`NetworkError`, or `NetworkTimeoutError`, and the SDK does not send the\n`sdkInitialized` event.\n\nTo update:\n\n1. Keep a `catch` on every `initialize` call. See\n [Handle initialization errors](../Quickstart.md#handle-initialization-errors).\n2. If a proxy, firewall, or allowlist sits between the browser and the\n Storyteller API, allow the requests in the table below.\n3. If your proxy answers CORS preflight requests, add\n `x-storyteller-recent-viewed-clip-ids` to its `Access-Control-Allow-Headers`\n response.\n\n| Request | Path or header |\n| --- | --- |\n| Viewing history | `GET /api/UserActivity/*` |\n| Clips pages | `GET /api/app/clips/{collection}/clips/paged/fresh` |\n| Recently viewed Clips | `x-storyteller-recent-viewed-clip-ids` header on Clips requests |\n\nSee [Remote viewing store](../PrivacyAndTracking.md#remote-viewing-store) for\nthe privacy options that control this request.\n\n### Local storage keys changed {#local-storage-keys-changed}\n\nVersion 11 uses new local storage keys for viewing history. It does not read\nthe 10.13 keys and does not remove them.\n\n| 10.13 key | 11.0 key |\n| --- | --- |\n| `Storyteller.clipLikes` | `Storyteller.likes` |\n| `Storyteller.clipsViewed` | `Storyteller.viewedClips` |\n| `Storyteller.pollAnswerMap` | `Storyteller.pollAnswers` |\n| `Storyteller.quizAnswerMap` | `Storyteller.triviaQuizAnswers` |\n| `Storyteller.storiesReadMap` | `Storyteller.readPages` |\n\nWith the default `enableRemoteViewingStore: true`, the SDK keeps viewing\nhistory in Storyteller, not in local storage. With\n`enableRemoteViewingStore: false`, the SDK keeps viewing history only in the\nnew local storage keys. Read Pages, likes, and answers that 10.13 saved do not\ncarry over, so Stories that users read in 10.13 show as unread.\n\nTo update:\n\n1. Replace the 10.13 key names in your cookie or consent inventory. The\n [local storage table](../PrivacyAndTracking.md#functional-cookies-and-local-storage-items)\n lists every current key.\n2. If your consent policy requires it, remove the five 10.13 keys yourself.\n\n### The script build loads files from its directory {#the-script-build-loads-files-from-its-directory}\n\nThe script build now downloads Story player, Clips player, Poll, Quiz, and\ncaption code as separate files the first time a page needs them. It loads\nthem from the directory that served `storyteller.min.js`. The Storyteller CDN\nserves every file. The npm package is not affected.\n\nIf you host the SDK files yourself:\n\n1. Copy every file in the version's `dist` directory to one directory on your\n server.\n2. Keep the file names.\n3. Load `storyteller.min.js` from its own `<script>` tag. Do not rename,\n bundle, or inline it.\n\nIf your page has a Content Security Policy, its `script-src` must allow the\ndirectory that serves the SDK files, on the CDN or on your server. A policy\nthat allows only a nonce or a hash for the main script also needs\n`'strict-dynamic'` or the SDK host.\n\nSee [Host the SDK files](script.md#host-the-sdk-files).\n\n### npm peer dependencies and entry points {#npm-peer-dependencies-and-entry-points}\n\nThe npm package now declares these peer dependencies, because its TypeScript\ndeclarations import them:\n\n- `@types/react`: `>=17 <20`\n- `@types/react-router-dom`: `^5.1.7`\n\nnpm 7 and later installs them. If `npm install` reports a peer dependency\nconflict, change your `@types/react` version to one in that range. See\n[TypeScript declarations](npm.md#typescript-declarations).\n\nThe package also adds `import` and `require` entry points and publishes its\ndeclarations at `dist/index.npm.d.ts`. It no longer ships `index.js`,\n`types/*.d.ts`, or SDK source files. Import only these paths:\n\n- `@getstoryteller/storyteller-sdk-javascript`\n- `@getstoryteller/storyteller-sdk-javascript/dist/storyteller.min.css`\n\nA default import resolves only in ES module builds. In CommonJS builds,\nincluding Jest, use `import * as Storyteller` or `require`. Version 10.13\nbehaved the same way.\n\n### Global and TypeScript changes {#global-and-typescript-changes}\n\n- The SDK no longer installs the `reflect-metadata` polyfill on the page's\n global `Reflect` object. If your code calls `Reflect.getMetadata` or\n `Reflect.defineMetadata`, import `reflect-metadata` in your application.\n- `ActivityType` has a new [`sdkInitialized`](../Analytics.md#sdk-initialization)\n member. Update exhaustive `switch` statements over `ActivityType`.\n- `Story` has new `pinnedChipText` and `customLiveChipText` properties. Add\n them to typed test data.\n- The undocumented `QuizRenderer.clearQuizData()` method was removed. Remove\n any calls to it.\n\n## Behavior changes {#review-version-11-behavior}\n\nThese changes need no code, but check them in your application:\n\n- **Player code loads on demand (script tag only)**: the script build\n downloads Story player, Clips player, Poll, Quiz, and caption code the first\n time a page needs it. The npm package still includes this code, and your\n bundler decides how it loads.\n- **AMP player preload**: each Stories row or grid starts a low-priority\n download of the AMP player script before the first Story opens. Set\n [`preload`](../StorytellerListView.md#preload) to `true` to prepare more of\n the Story player in advance.\n- **Story ordering**: when the Stories API uses\n [started-aware ordering](../StorytellerListView.md#story-ordering), rows\n and grids show Stories the user has not opened, then Stories in progress,\n then finished Stories. Pinned and Live Stories keep their priority.\n- **Clips paging**: Clips rows, grids, and players that show a Collection\n [load more Clips](../StorytellerListView.md#clips-paging) as the user\n reaches the last loaded Clip. The\n [`onDataLoadComplete` callback](../StorytellerListViewDelegate.md) reports\n the number of Clips in the first page as `dataCount`. Later pages load\n without delegate callbacks.\n- **Clip details**: the Clips player can show a\n [long description](../StorytellerListView.md#clip-details) in an expandable\n details area.\n- **Story chips**: Story tiles can show\n [custom Live and pinned chip text](../Themes.md#live-chip-gradient-and-borders)\n from Story content.\n- **Compact Clip action buttons**: if your remote theme sets\n [`clipsActionButtonCompactSize`](../Themes.md#compact-clip-action-buttons),\n the Clips player shows smaller action buttons.\n- **Like and share counts**: if your remote theme sets\n [`showLikeCount` or `showShareCount`](../Themes.md#clip-player) to `false`,\n the Clips player hides that count.\n- **Caption defaults**: each [caption theme](../Themes.md#closed-captions)\n field set for a feed now overrides only that field of the tenant caption\n theme. Default captions use 16 px text, the font's natural line height, and\n a `#171A25` background instead of 18 px text, a 22 px line height, and a\n `#000000` background.\n- **Stories with no Pages**: rows and grids no longer show them.\n- **`sdkInitialized` event**: `onUserActivityOccurred` receives\n [`sdkInitialized`](../Analytics.md#sdk-initialization) during `initialize`.\n If your handler maps every event type, make it ignore or record this one.\n\n## Update an npm integration {#update-an-npm-integration}\n\nInstall version 11.0.0.\n\n```shell\nnpm install @getstoryteller/[email protected]\n```\n\nIf npm reports a peer dependency conflict, see\n[npm peer dependencies and entry points](#npm-peer-dependencies-and-entry-points).\n\nKeep the SDK and stylesheet imports together.\n\n```javascript\nimport * as Storyteller from '@getstoryteller/storyteller-sdk-javascript';\nimport '@getstoryteller/storyteller-sdk-javascript/dist/storyteller.min.css';\n```\n\n## Update a script integration {#update-a-script-integration}\n\nChange the version segment in the CDN URL.\n\n```html\n<script src=\"https://content.usestoryteller.com/javascript-sdk/11.0.0/dist/storyteller.min.js\"><\/script>\n```\n\nUse the fixed URL in production. This keeps later releases from changing the\nSDK without an application deployment.\n\nEarlier guides showed a `/javascript-sdk/latest/` URL. That path does not\nserve production releases. Replace it with a fixed version URL, such as the\none above.\n\nIf you host the SDK files yourself, copy every file in the 11.0.0 `dist`\ndirectory. See\n[The script build loads files from its directory](#the-script-build-loads-files-from-its-directory).\n\n## Test the update {#test-the-update}\n\nCheck these paths with version 11.0.0:\n\n1. Initialize the SDK with a test tenant. Check that `initialize` resolves.\n With the default privacy options, also check that the viewing-history\n request succeeds in the browser's network panel.\n2. Load every row, grid, and embedded player your application uses. Check\n Story ordering and later Clips pages where your tenant enables them.\n3. Open and close Story and Clips players. Check long Clip descriptions,\n custom Story chips, compact Clip action buttons, like and share counts,\n captions, and long Poll and Quiz answers where you use them.\n4. Read a Story, reload the page, and check that the Story still shows as\n read. Repeat the check after you change between anonymous and signed-in\n users, if your application supports both.\n5. If you host the SDK files, open a Story, a Clips player, a Poll, and a\n Quiz. Check that each player, Poll, Quiz, and caption file loads from your\n server with no `404` errors.\n6. Open each player and check the browser console for Content Security Policy\n errors.\n7. Confirm privacy settings, analytics callbacks, and ad requests. Check the\n `sdkInitialized` event if your application handles activity events.\n8. Change routes in a single-page application. Check that your code calls\n [`destroy()`](../StorytellerListView.md#destroy) before it removes a view's\n container, and that a new view appears when the route returns.\n\nReview the [release notes](../Changelog.md) for other changes that apply to\nyour integration.\n\n## Roll back {#roll-back-a-test-deployment}\n\nRestore the previous fixed npm version or CDN URL, then rebuild and deploy the\napplication. If you host the SDK files, restore the 10.13 files too. Keep the\nprevious version number in the release record until the version 11 checks\npass.\n\nVersion 10.13 does not read the local storage keys that version 11 uses.\n\n## Get help\n\nIf the update fails, work through\n[Troubleshoot an integration](troubleshooting.md). If you still need help,\ncontact [Storyteller Support](mailto:[email protected]).\n", "copy_markdown_include_header": false, "base_path": "", "ai_dir": "ai", "missing_payload_behavior": "empty"}