Experimentation Lab
Interactive implementation reference
Feature SDK implementation

Next.js SSR

A server-rendered decision made at the application origin with a stable visitor cookie.

Node.js origin · RSC

Live decision runner

Simulation mode
No credential is stored in this repo. Simulation is deterministic and clearly labeled. Add an environment SDK key to send real decisions and events; it stays in this browser’s local storage.

Implementation

Official docs ↗
npm install @optimizely/optimizely-sdk
const client = createInstance({
  projectConfigManager: createPollingProjectConfigManager({ sdkKey }),
  eventProcessor: createBatchEventProcessor(),
});
await client.onReady();
const user = client.createUserContext(visitorId, attributes);
const decision = await user.decideAsync('demo_flag');
return <Hero variation={decision.variationKey} />;