> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://contentful.com/developers/docs/personalization/optimization-sdk/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://contentful.com/developers/docs/_mcp/server. # Optimization SDK ## Docs - [Optimization SDK](https://contentful.com/developers/docs/personalization/optimization-sdk/overview.md): An introduction to the Optimization SDK suite and how you can integrate it with your setup. - [Choose the right SDK](https://contentful.com/developers/docs/personalization/optimization-sdk/choose-the-right-sdk.md): A guide to help you decide which SDK is best for your setup. - [Integrate the Optimization Node SDK in a Node app](https://contentful.com/developers/docs/personalization/optimization-sdk/integrate-the-node-sdk-into-a-node-app.md): This guide helps you implement server-side personalization in a Node runtime such as Express, a custom SSR server, or a server-side function. - [Integrate the Optimization Web SDK in a web app](https://contentful.com/developers/docs/personalization/optimization-sdk/integrate-the-web-sdk-in-a-web-app.md): This guide helps you implement client-side personalization and analytics in a browser application, such as a static site, multi-page app, SPA, or custom frontend runtime. - [Integrate the Optimization React Web SDK in a React app](https://contentful.com/developers/docs/personalization/optimization-sdk/integrate-the-react-web-sdk-in-a-react-app.md): This guide helps you add personalization and analytics to a React web application using `@contentful/optimization-react-web`. - [Integrate the Optimization Next.js SDK in a Next.js App Router app](https://contentful.com/developers/docs/personalization/optimization-sdk/integrate-the-optimization-sdk-in-a-nextjs-app-router-app.md): This guide helps you render a personalized Contentful entry on the server in a Next.js App Router app and keep the same result when the browser starts, using an Optimization handoff. - [Integrate the Optimization Next.js SDK in a Next.js Pages Router app](https://contentful.com/developers/docs/personalization/optimization-sdk/integrate-the-optimization-sdk-in-a-nextjs-pages-router-app.md): This guide helps you render personalized Contentful entries in `getServerSideProps` for a Next.js Pages Router app, then hydrate the browser from the same Optimization handoff. - [Integrate the Optimization React Native SDK in a React Native app](https://contentful.com/developers/docs/personalization/optimization-sdk/integrate-the-react-native-sdk-in-a-react-native-app.md): This guide helps you add personalization, analytics, screen tracking, and a preview panel to a React Native (or Expo) application. - [Integrate the Optimization iOS SDK in a SwiftUI app](https://contentful.com/developers/docs/personalization/optimization-sdk/integrate-the-optimization-ios-sdk-in-a-swiftui-app.md): Use this guide to add Contentful personalization to a SwiftUI app using the Optimization iOS SDK. - [Integrate the Optimization iOS SDK in a UIKit app](https://contentful.com/developers/docs/personalization/optimization-sdk/integrate-the-optimization-ios-sdk-in-a-uikit-app.md): Use this guide to add Contentful personalization to a UIKit app with the `ContentfulOptimization` Swift Package. - [Integrate the Optimization Android SDK in a Jetpack Compose app](https://contentful.com/developers/docs/personalization/optimization-sdk/integrate-the-optimization-android-sdk-in-a-compose-app.md): Use this guide to add Contentful personalization to a Jetpack Compose app with the Optimization Android SDK. - [Integrate the Optimization Android SDK in an Android Views app](https://contentful.com/developers/docs/personalization/optimization-sdk/integrate-the-optimization-android-sdk-in-a-views-app.md): Use this guide to add Contentful personalization to a native Android app built with XML layouts and Android Views. - [Use Contentful GraphQL data with the Optimization SDKs](https://contentful.com/developers/docs/personalization/optimization-sdk/use-contentful-graphql-data-with-the-optimization-sdks.md): Use this guide when your app fetches Contentful data through the Contentful GraphQL Content API and wants an Optimization SDK to choose which authored entry to render for a visitor. - [Build a custom JavaScript Optimization adapter](https://contentful.com/developers/docs/personalization/optimization-sdk/build-a-custom-javascript-optimization-adapter.md): Use this guide when you are building a JavaScript runtime or framework adapter and no official Optimization SDK package fits that surface. - [Render personalized Next.js routes with static, ISR, and edge handoffs](https://contentful.com/developers/docs/personalization/optimization-sdk/render-personalized-nextjs-routes.md): Use this guide to render a Next.js route from application-chosen Optimization selections, cache the result at the right scope, and hydrate the browser from the same state. - [Forward Optimization SDK context to analytics and tag-management tools](https://contentful.com/developers/docs/personalization/optimization-sdk/forwarding-optimization-sdk-context-to-analytics-and-tag-management-tools.md): Use this guide when your application already sends events to an analytics, tag-management, customer-data, replay, or product-analytics destination and you want to attach approved Optimization SDK context to those events. - [Core state management](https://contentful.com/developers/docs/personalization/optimization-sdk/core-state-management.md): Understand how `CoreStateful` stores its internal state, why that state is protected from outside interference, and which surface the SDK explicitly provides for consumers to observe and influence state. - [Consent management in the Optimization SDK Suite](https://contentful.com/developers/docs/personalization/optimization-sdk/consent-management-in-the-optimization-sdk-suite.md): Design consent flows that use the Optimization SDK suite without treating the SDK as the policy engine. - [Entry optimization and variant resolution](https://contentful.com/developers/docs/personalization/optimization-sdk/entry-personalization-and-variant-resolution.md): Understand how the Optimization SDK suite resolves a Contentful baseline entry to the entry variant selected for a visitor. - [Locale handling in the Optimization SDK Suite](https://contentful.com/developers/docs/personalization/optimization-sdk/locale-handling-in-the-optimization-sdk-suite.md): Understand how to keep the application Contentful locale separate from the SDK Experience/event locale across Web, React Web, Next.js, Node, React Native, iOS, and Android applications. - [Interaction tracking in Web SDKs](https://contentful.com/developers/docs/personalization/optimization-sdk/interaction-tracking-in-web-sdks.md): Understand how browser interaction tracking works in `@contentful/optimization-web` and the React layer provided by `@contentful/optimization-react-web`. - [Interaction tracking in Node and stateless environments](https://contentful.com/developers/docs/personalization/optimization-sdk/interaction-tracking-in-node-and-stateless-environments.md): Understand how the Optimization SDK Suite resolves a Contentful baseline entry to the entry variant selected for a visitor. - [Profile synchronization between client and server](https://contentful.com/developers/docs/personalization/optimization-sdk/profile-synchronization-between-client-and-server.md): Understand how the Optimization SDK Suite keeps a visitor profile continuous when a Node server and a browser client both participate in personalization and analytics. - [Optimization handoff and cache-safe rendering](https://contentful.com/developers/docs/personalization/optimization-sdk/optimization-handoff-and-cache-safe-rendering.md): Understand how server, static, and edge-rendered Optimization state reaches the browser without putting visitor-specific profile state into public caches. - [React Native SDK interaction tracking mechanics](https://contentful.com/developers/docs/personalization/optimization-sdk/react-native-sdk-interaction-tracking-mechanics.md): Understand what the `@contentful/optimization-react-native` SDK is tracking, when each event fires, and how it leaves the device. - [iOS SDK runtime and interaction mechanics](https://contentful.com/developers/docs/personalization/optimization-sdk/ios-sdk-runtime-and-interaction-mechanics.md): Understand how the Optimization iOS SDK runs shared optimization behavior in a native app, how SwiftUI and UIKit integrations share the same client, and how consent, state, entry resolution, tracking, preview overrides, and offline delivery work. - [Android SDK runtime and interaction mechanics](https://contentful.com/developers/docs/personalization/optimization-sdk/android-sdk-runtime-and-interaction-mechanics.md): Understand how the Optimization Android SDK runs shared optimization behavior in a native app, how Compose and XML Views integrations share the same client model, and how consent, state, entry resolution, tracking, preview overrides, and offline delivery work. - [Migrate Optimization SDK packages from v1 to v2](https://contentful.com/developers/docs/personalization/optimization-sdk/migrate-optimization-sdk-v1-to-v2.md): Upgrade Optimization SDK packages from their final v1 releases to v2 while preserving the intended Contentful space environment and updating direct API and schema integrations. - [Migrate an experience.js Contentful model to Optimization](https://contentful.com/developers/docs/personalization/optimization-sdk/migrate-an-experiencejs-contentful-model-to-optimization.md): Use this guide when a Contentful space uses Ninetailed-authored experience entries, legacy `nt_*` fields, or `@ninetailed/experience.js-utils-contentful` mapper code and you need the authored content ready for Optimization SDK rendering. - [Migrate experience.js to the Optimization Web SDK](https://contentful.com/developers/docs/personalization/optimization-sdk/migrate-experiencejs-to-web-sdk.md): Use this guide when a plain browser app or custom JavaScript adapter uses `@ninetailed/experience.js` and you want to move to `@contentful/optimization-web`. - [Migrate experience.js React to the React Web SDK](https://contentful.com/developers/docs/personalization/optimization-sdk/migrate-experiencejs-to-react-web.md): Use this guide when a React app uses `@ninetailed/experience.js-react` providers, hooks, components, or flags and you want to move to `@contentful/optimization-react-web`. - [Choose a Next.js migration path from experience.js](https://contentful.com/developers/docs/personalization/optimization-sdk/choose-a-nextjs-migration-path-from-experience-js.md): Use this guide when a Next.js app uses `@ninetailed/experience.js-next`, `@ninetailed/experience.js-next-esr`, or SSR plugin behavior and you need to choose App Router, Pages Router, or a manual Node/Web hybrid target before changing code. - [Migrate experience.js Next.js to the App Router SDK](https://contentful.com/developers/docs/personalization/optimization-sdk/migrate-experiencejs-next-to-nextjs-app-router.md): Use this guide when a Next.js App Router app carries legacy Next.js, ESR, SSR plugin, or React experience.js wiring and you want to move server rendering to `@contentful/optimization-nextjs/app-router/server`, with `@contentful/optimization-nextjs/app-router/client` only for bound Client Components. - [Migrate experience.js Next.js to the Pages Router SDK](https://contentful.com/developers/docs/personalization/optimization-sdk/migrate-experiencejs-next-to-nextjs-pages-router.md): Use this guide when a Pages Router app uses `@ninetailed/experience.js-next`, SSR plugin behavior, or legacy React surfaces and you want to move to the Optimization Pages Router SDK. - [Migrate experience.js Node, SSR, and ESR](https://contentful.com/developers/docs/personalization/optimization-sdk/migrate-experiencejs-node-ssr-and-esr.md): Use this guide when server code uses `@ninetailed/experience.js-node`, SSR plugin helpers, ESR helpers, or a manual server-to-browser handoff. - [Migrate experience.js plugins and preview](https://contentful.com/developers/docs/personalization/optimization-sdk/migrate-experiencejs-plugins-and-preview.md): Use this guide when an app uses experience.js analytics, privacy, preview, insights, or third-party plugin packages and you need to replace them with Optimization SDK Suite surfaces.