Experiments
Feature Flags
Analytics

Top 9 AB Tasty alternatives: Best options for 2026

A graphic of a bar chart with an arrow pointing upward.

The best AB Tasty alternative depends on whether you are replacing website optimization, personalization, feature experimentation, or the service wrapped around the platform.

AB Tasty is no longer only a client-side A/B testing tool. Its current offering includes visual web experiments, A/B/n and multivariate tests, Bayesian, frequentist, and sequential statistics, personalization, feature flags, progressive delivery, server-side experiments, recommendations, merchandising, AI assistance, and customer-success services.

That breadth creates two common mistakes in an alternatives search. The first is comparing AB Tasty’s full scope with a narrow, low-cost page-testing tool. The second is assuming a broad experience-optimization suite is the right replacement when the organization’s real need has shifted to product experiments and warehouse metrics.

There is also an important 2026 market change: VWO and AB Tasty announced that they joined forces in January. VWO appears on many historical alternatives lists, including review marketplaces, but it is no longer a clean independent alternative. Buyers should evaluate the combined company’s roadmap, contracts, data handling, and product consolidation directly. For that reason, VWO is not ranked among the nine options below.

GrowthBook is the best overall AB Tasty alternative for modern product teams. It combines feature flags, code and visual experiments, product analytics, warehouse-native measurement, transparent statistical methods, and open deployment choices. Teams centered on web conversion optimization may prefer Kameleoon, Optimizely, or Convert. Teams consolidating technical product tools may prefer Statsig, PostHog, Amplitude, or LaunchDarkly. Adobe Target makes sense when Experience Cloud is already strategic.

AB Tasty alternatives at a glance

AlternativeBest forMain difference from AB TastyPricing shape
GrowthBookWarehouse-native product experimentationOpen source, transparent SQL, unified flags and experimentsFree, per-seat Pro, custom Enterprise
KameleoonAI-assisted web and feature testingPrompt-based variation creation plus visual and SDK workflowsStarter and custom Enterprise
OptimizelyMature enterprise programsSeparate web and feature experimentation products with program depthLimited free rollouts; custom paid contracts
Convert ExperiencesFocused website CROTransparent self-serve plans and privacy-oriented testingTested-user tiers, published Growth and Pro pricing
StatsigIntegrated technical product suiteExperiments, flags, analytics, and replay on one platformFree, usage-based Pro, custom Enterprise
PostHogStartups consolidating product toolsBroad developer stack with granular usage pricingPay per use after free allowances
AmplitudeExisting Amplitude analytics teamsAnalytics-led cohorts, feature tests, and web experimentsFree entry, volume-based paid tiers
LaunchDarklyFeature delivery and governanceRelease-control depth with flag-based experimentsFree developer, usage-based, custom
Adobe TargetAdobe Experience Cloud enterprisesEnterprise personalization and testing in Adobe’s ecosystemCustom licensing

Independent review sources emphasize different categories. G2’s AB Tasty alternatives lean toward web testing and personalization, while TrustRadius comparisons include both enterprise and smaller-business options. Use those lists to find candidates, then test the workflows and data model you actually need.

Why teams look beyond AB Tasty

They want product experimentation to lead

AB Tasty supports feature experiments, but many organizations still associate its operating model with marketing-led web optimization. A team moving into backend, mobile, algorithm, or pricing experiments may prefer a platform whose primary concepts are flags, governed metrics, exposure, and product releases.

They want warehouse-native metrics and reproducibility

Revenue, subscription state, retention, refunds, support outcomes, and offline behavior often live in a warehouse. Rebuilding those definitions inside an optimization platform can create metric drift. Data teams may prefer direct warehouse analysis and inspectable queries.

They want a different commercial model

AB Tasty pricing is custom based on traffic or MAUs, domains, modules, and implementation scope. The company says core experimentation includes onboarding, training, and ongoing support, with optional products and services scoped into the agreement. That can be valuable, but self-serve teams may prefer published seat, tested-user, event, or request pricing.

They do not need the full platform

A CRO team may need visual tests but not feature delivery or recommendations. A product team may need flags and experiments but not merchandising. Buying a focused alternative can reduce both license cost and organizational surface area.

They want to reassess after the VWO combination

The merger does not imply current AB Tasty customers should leave. It does create reasonable diligence questions: Which products converge? Which remain? How do contracts, support, data regions, roadmaps, and migration paths change? Evaluate those answers alongside independent alternatives.

Current G2 reviews of AB Tasty often praise ease of use and support while noting advanced setup, integrations, reporting, learning curve, and bundled value as considerations. Those themes should become proof-of-concept scenarios, not generalized conclusions.

What a replacement must preserve

Before ranking tools, document the capabilities already embedded in the program.

Visual behavior and performance

Inventory the AB Tasty tag, tag-manager sequence, anti-flicker configuration, consent interaction, audience activation, single-page routing, custom JavaScript, QA links, and browser coverage. A replacement should be tested on slow devices, dynamic pages, logged-in states, checkout, and pages where no campaign runs.

Measure render delay, layout shift, flicker, script errors, variation consistency, and Core Web Vitals. “Lightweight” and “edge-delivered” are claims to verify against your own site.

Statistics and data quality

AB Tasty’s current pricing page lists Bayesian, frequentist, and sequential methods. Record which method each team uses, how it handles repeated looks, multiple goals, outliers, traffic allocation, and stopping.

The replacement should also detect broken allocation and telemetry. Microsoft’s research on sample-ratio mismatch shows that unexpected treatment counts can result from many implementation failures. Deliberately introduce one during evaluation and see whether the platform helps diagnose it.

Personalization and commerce

If the organization uses EmotionsAI, recommendations, search, merchandising, campaign prioritization, widgets, or third-party segments, a pure experimentation platform is not a full replacement. Decide whether these remain in one suite, move to specialist products, or are no longer needed.

Services and operating support

AB Tasty includes onboarding, training, support, and optional managed services in its commercial model. Compare implementation labor, experiment QA, statistical consulting, office hours, SLAs, and strategic services—not just software fees.

Historical learning

Export hypotheses, screenshots, targeting, goals, daily results, decisions, campaign code, owners, and final outcomes. A replacement that cannot ingest the history still needs a searchable archive so teams do not lose years of learning.

How the VWO and AB Tasty combination changes the shortlist

The January 2026 announcement matters because VWO was previously the most obvious like-for-like AB Tasty alternative. Both companies sell visual testing, targeting, personalization, conversion optimization, and adjacent product capabilities. Treating them as independent bids after they joined forces would create false competitive pressure and could hide shared roadmap or commercial decisions.

The combination may also benefit customers. A larger product and services organization could invest more in editors, AI assistance, behavioral insight, geographic support, and enterprise infrastructure. Existing customers should not assume disruption. They should ask concrete questions before renewal or migration.

Product roadmap

Request a written map of overlapping and complementary products. Ask which visual editor, tag, statistics engine, results interface, audience builder, AI assistant, server-side product, and personalization capabilities remain strategic. Clarify whether products will converge, interoperate, or continue separately.

Roadmap language such as “best of both platforms” is not enough for a technical plan. Teams need expected dates, migration requirements, data compatibility, deprecation policy, and support periods. If a capability is critical, include its continuity in the contract or evaluate an alternative that already provides it.

Contracts and pricing

The companies may retain separate packaging for a long time, but buyers should still model consolidation risk. Ask whether the renewal metric remains traffic, MAUs, tested visitors, seats, modules, or another measure. Confirm discounts, services, add-ons, overages, renewal caps, contract assignment, and the commercial treatment of customers that use products from both companies.

Do not compare a current AB Tasty renewal with a public VWO checkout as if they were unrelated bids. Ask for the available combined-company options, then compare those with truly independent vendors. An external 2026 digital-experience analytics report also identifies VWO and AB Tasty together, reinforcing that market comparisons need to reflect the new structure.

Data and architecture

Document where each product stores visitor, event, audience, result, and account data. Ask whether data regions, subprocessors, CDNs, cookies, identifiers, encryption, retention, APIs, exports, and deletion workflows will change.

For web experimentation, determine whether tags remain distinct and whether customers will ever be asked to run both. For feature experimentation, compare SDK roadmaps, configuration formats, evaluation behavior, assignment, streaming, and fallback defaults. A merged commercial offering does not automatically mean one compatible runtime.

Support and services

Both companies have historically emphasized support. Confirm the account team, escalation path, support hours, response targets, implementation services, experimentation consulting, training, academy access, and partner relationships for the coming contract period.

A larger organization can expand expertise, but reorganizations can also change ownership. Use the proof of concept to test actual support response and request named migration resources for any required product transition.

The decision rule

Stay when the combined roadmap preserves the workflows you use, the price remains acceptable, support is strong, and the organization would not benefit materially from changing its data or product-development model.

Evaluate independent alternatives when the merger creates uncertainty in a critical capability, when renewal timing provides a practical migration window, or when the experimentation program has already shifted away from visual CRO toward flags, warehouse metrics, product analytics, or another operating model.

Do not migrate merely because ownership changed, and do not renew merely because migration is inconvenient. Compare the next two years of roadmap, data, operating labor, and cost under both paths.

1. GrowthBook: Best overall AB Tasty alternative

Best for

GrowthBook fits product, engineering, and data teams that want experimentation tied directly to feature delivery and trusted business metrics. It supports feature flags, code-based tests, URL redirects, a visual editor, holdouts, and product analytics without forcing the warehouse to stop being the source of truth.

Key strengths

The same flag can control an internal release, progressive rollout, experiment, and final launch. GrowthBook’s experimentation platform supports frequentist and Bayesian analysis, sequential testing, CUPED, and transparent methodology.

Warehouse-native queries let analysts inspect SQL and reuse governed metrics. Cloud, managed-warehouse, and self-hosted options give teams flexibility that a cloud-only optimization platform may not.

The GrowthBook versus AB Tasty comparison details product positioning; independent GrowthBook reviews on Gartner Peer Insights can help validate fit beyond the vendor page.

Watchouts

Teams still need clean identity, exposure data, and metric definitions. Warehouse-native analysis reveals data problems; it does not remove them. The visual editor is useful for bounded web changes, but deeper product variants require engineering implementation and QA.

Pricing and implementation notes

GrowthBook pricing currently lists a free cloud Starter tier for up to three users, Pro at $40 per seat per month, and custom Enterprise pricing. Unlimited flags and experiments are listed across those cloud tiers. Self-hosting is available.

2. Kameleoon: Best independent visual and feature experimentation suite

Best for

Kameleoon is a strong fit for organizations that want a recognizable alternative to AB Tasty’s combined web and feature experimentation scope. It serves marketers, product managers, and developers through prompt-based, visual, code, and SDK workflows.

Key strengths

Prompt-Based Experimentation can generate web variations from natural-language instructions. The platform also supports visual editing, feature flags, server-side tests, targeting, holdouts, SRM detection, CUPED, sequential testing, and multiple-testing correction.

Kameleoon’s single-page application capabilities emphasize modern frameworks and shared web/feature workflows. G2 reviews for Kameleoon praise support, flexibility, and ease while also noting developer dependency, learning curve, documentation, and complex-test setup.

Watchouts

AI-produced variants still need review for performance, accessibility, security, responsive behavior, consent, and maintainability. Run both a page test and an SDK test to confirm the identity and metrics model truly spans the workflows.

Pricing and implementation notes

Kameleoon plans list a trial, PBX Starter from $495 per month for up to ten experiments and 50,000 tested visitors, and custom Enterprise plans. Feature management can be added. Confirm domains, traffic definitions, SDKs, support, and advanced statistics.

3. Optimizely: Best for mature enterprise experimentation programs

Best for

Optimizely suits large organizations that want deep web experimentation, feature experimentation, program operations, personalization, and enterprise controls. It is most credible when separate specialists own web and product experimentation.

Key strengths

Web Experimentation provides visual and code-based tests, audiences, multivariate tests, and program features. Feature Experimentation provides SDKs, feature flags, targeted delivery, and full-stack A/B tests. Mature capabilities include holdouts, experiment planning, statistical engines, results exploration, and lifecycle management.

G2 reviews of Optimizely Web Experimentation provide independent evidence on ease, flexibility, setup, learning curve, support, and reporting.

Watchouts

Optimizely may recreate the enterprise breadth and custom procurement that motivated the AB Tasty search. Evaluate Web and Feature Experimentation as distinct products and test how data, identity, and workflows connect.

Pricing and implementation notes

Optimizely’s plan page says products are individually packaged. A limited Rollouts tier supports free flags and one experiment, while paid experimentation is customized by traffic, MAUs, products, and implementation. Request line items for each product, services, data export, support, and renewal.

4. Convert Experiences: Best focused website testing alternative

Best for

Convert Experiences fits CRO teams, agencies, and web operators that want a focused A/B, split-URL, multivariate, and personalization system with published self-serve pricing and strong privacy positioning.

Key strengths

Convert supports a visual and code editor, many targeting conditions, goals, multipage experiments, quality checks, SRM protection, integrations, and project controls. It can cover sophisticated website programs without requiring a broad product analytics or merchandising suite.

G2 reviews of Convert Experiences praise flexibility, support, ease, and value while raising reporting, tracking, mobile-app, and price considerations.

Watchouts

Convert is strongest for web optimization. Teams replacing AB Tasty Feature Experimentation, mobile SDKs, recommendations, or advanced commerce personalization should verify gaps or select separate systems.

Pricing and implementation notes

Convert pricing currently lists Growth at $399 monthly or $299 per month paid annually, and Pro at $599 monthly or $420 per month paid annually, each at 100,000 tested users. Enterprise is custom. Check projects, domains, deploys, goals, overuse pricing, and support.

5. Statsig: Best integrated suite for technical product teams

Best for

Statsig fits teams that want experiments, feature flags, product analytics, session replay, and web analytics on one technical platform. It is a better replacement for AB Tasty when product development, not ecommerce personalization, is the primary job.

Key strengths

Feature gates, experiment results, metrics, funnels, and replay share a data foundation. The platform supports frequentist and Bayesian analysis, multivariate experiments, templates, no-code tests, and enterprise warehouse-native deployment.

G2’s Statsig reviews often praise experimentation depth, analytics, and usability while surfacing setup, documentation, complexity, and data issues to test.

Watchouts

An integrated suite creates overlap if the organization already has trusted analytics, replay, and flags. Usage-based event pricing also requires a telemetry-level forecast.

Pricing and implementation notes

Statsig pricing lists a free tier with two million events, Pro at $150 per month with five million events and overages, and custom Enterprise deployment. Confirm metered exposure rules, projects, retention, replay, and support.

6. PostHog: Best for startups consolidating product tooling

Best for

PostHog works for startups and engineering-led teams that want analytics, replay, feature flags, experiments, surveys, and data tooling from one developer-oriented provider.

Key strengths

The system connects behavioral research, product metrics, flag-based delivery, and experiment analysis. Open-source code, extensive documentation, and transparent self-serve pricing reduce procurement friction.

G2 reviews of PostHog praise breadth, setup, and the free tier while identifying learning curve, dashboard complexity, missing features, and occasional performance issues.

Watchouts

PostHog is not a like-for-like replacement for AB Tasty personalization, recommendations, or managed CRO services. Teams also need explicit event, exposure, identity, and metric governance rather than relying only on autocapture.

Pricing and implementation notes

PostHog pricing is pay-per-use with free allowances, including one million analytics events, 5,000 replay recordings, and one million feature-flag requests on the current page. Experiments use feature flags. Model each enabled product and set billing limits.

7. Amplitude: Best for organizations already using Amplitude Analytics

Best for

Amplitude is a logical choice when product teams already trust its funnels, retention, cohorts, and event taxonomy. Feature and web experimentation can live near the behavioral analysis that generates hypotheses.

Key strengths

Teams can define audiences from analytics, deliver feature or web variants, and investigate outcomes in the same platform. Amplitude also includes replay, guides, surveys, activation, and AI capabilities across its current offering.

Independent G2 reviews of Amplitude Feature Experimentation praise analytics integration and rollout control while noting identity, timing, complexity, SDK, and metric concerns.

Watchouts

Convenience does not replace a statistics review. Test allocation, exposure, SRM detection, guardrails, sequential monitoring, variance reduction, and warehouse reconciliation. Identity transitions from anonymous to logged-in users deserve special attention.

Pricing and implementation notes

Amplitude pricing lists a free tier with two million events and limited experiments. Web Experimentation is usage-based on impressions. Verify experiment limits, advanced methods, retention, warehouse access, and the events or impressions needed at scale.

8. LaunchDarkly: Best for release control and feature governance

Best for

LaunchDarkly fits engineering-led organizations replacing AB Tasty mainly for feature flags, progressive delivery, approvals, targeting, and full-stack experiments.

Key strengths

Experiments attach metrics to feature-flag variations, connecting deployment, release, measurement, and rollout. LaunchDarkly adds mature environments, SDKs, workflows, observability, and governance.

G2 reviews of LaunchDarkly frequently praise targeting and release safety while mentioning cost, flag sprawl, UI complexity, and the need for disciplined metadata.

Watchouts

LaunchDarkly is not a visual CRO or ecommerce personalization suite. Confirm how experiment metrics, raw data, and analytics integrate with the warehouse. Require owners, descriptions, expiration, and cleanup for flags.

Pricing and implementation notes

LaunchDarkly pricing changed in 2026. The current page lists a free Developer tier, Foundation pricing based on service connections and client-side MAUs, and custom Enterprise and Guardian plans. Model experimentation, retention, observability, environments, and growth.

9. Adobe Target: Best for Adobe Experience Cloud enterprises

Best for

Adobe Target fits organizations already using Adobe Analytics, Experience Manager, audiences, and other Experience Cloud products. It is a broad enterprise option for testing, personalization, recommendations, and omnichannel experiences.

Key strengths

Target supports A/B and multivariate tests, a visual experience composer, rules-based targeting, automated allocation, personalization, and recommendations. Adobe integrations can make it a more complete AB Tasty replacement for large commerce and marketing organizations than a standalone experiment tool.

G2 reviews of Adobe Target praise ecosystem integration and personalization depth while describing learning curve, technical setup, debugging, support, and cost as evaluation areas.

Watchouts

Adobe Target can require specialist implementation and administration. It is rarely the simplest choice for a standalone product team or a company without a broader Adobe strategy.

Pricing and implementation notes

Adobe Target pricing is custom based on product options, volume, and omnichannel delivery. Include services, Analytics dependencies, profiles, regions, data feeds, and application implementation in the estimate.

How to choose the right alternative

Start with the work, not the vendor list. Inventory:

  • Web, feature, mobile, server-side, personalization, and commerce campaigns.
  • Monthly visitors, tested users, events, exposures, MAUs, domains, and apps.
  • Visual-editor usage versus custom code and SDK implementation.
  • Metrics, analytics connectors, identity rules, consent, and data regions.
  • Recommendations, search, merchandising, segments, and widgets.
  • Services, training, support, approvals, roles, SSO, audits, and SLAs.

Then map the operating model:

  • Choose GrowthBook for warehouse-native product experimentation and transparent methods.
  • Choose Kameleoon for an independent combined web and feature experimentation suite.
  • Choose Optimizely for a mature enterprise experimentation program.
  • Choose Convert for focused web CRO with published tested-user pricing.
  • Choose Statsig or PostHog for an integrated technical product stack.
  • Choose Amplitude when analytics adoption is already deep.
  • Choose LaunchDarkly when release governance is the main requirement.
  • Choose Adobe Target when Adobe ecosystem integration is strategic.

Run a real proof of concept, not a vendor demo. Build one representative web test and one product test if both are in scope. Measure page performance, assignment, data reconciliation, metric reproducibility, permissions, rollback, support response, and cost at next year’s scale. Use a power analysis to verify the audience can answer the proposed question.

A safe migration plan from AB Tasty

1. Separate product inventories

Catalog Web Experimentation, Feature Experimentation, personalization, recommendations, search, merchandising, AI, and services independently. Record owners, tags, SDKs, segments, goals, events, integrations, regions, and contracts.

2. Freeze definitions

Document identity, eligibility, traffic allocation, actual exposure, attribution windows, goals, filters, and statistical methods. Recreate them explicitly in the new system.

3. Validate in parallel

Run A/A tests, shadow event collection, and matched metric reports. Investigate count differences, SRM, flicker, consent behavior, page performance, and identity transitions before trusting business results.

4. Move low-risk use cases first

Start with new campaigns, internal targeting, development environments, and inactive flags. Do not move a running revenue-critical experiment unless assignment and inference can be preserved.

5. Preserve rollback and history

Keep AB Tasty access until active campaigns finish, new data reconciles, historical reports are archived, and rollback is rehearsed. Remove the old tag and SDK paths only after traffic confirms they are unused.

GrowthBook is the best overall AB Tasty alternative for teams whose experimentation program is becoming part of product development. It unifies release controls and trustworthy measurement while letting the organization use warehouse metrics, transparent SQL, advanced statistics, and cloud or self-hosted deployment.

To evaluate the workflow with your own stack, get started with GrowthBook or book a demo. Compare real decisions, data reconciliation, implementation effort, and total operating cost before choosing the next platform.

Table of Contents

Related Articles

See All Articles
Feature Flags
Experiments

Add local feature flags to a React app with TypeScript

Nov 20, 2026
x
min read

A magazine's home page shows two recent issues. The design team wants subscribers to try a shelf with four. All four covers are public, and changing editions while the page is open should update the shelf immediately. That gives you a small React feature with a useful acceptance test. Click from guest to subscriber and back, and count the covers each time.

We'll put the display limit in a typed local flag, evaluate it inside a React component, and leave the choice of edition with the app. The example runs in a client-rendered React app without a GrowthBook account, an SDK key, or a request for flag rules. For the wider workflow, free feature flags for coding agents explains what to ask an agent to implement and how to review the result.

Define what one flag controls

Start with an existing React and TypeScript app, or create a Vite React project for the example. Install both GrowthBook packages so the definitions and the hooks resolve against compatible SDK versions.

npm create vite@latest issue-shelf -- --template react-ts
cd issue-shelf
npm install
npm install @growthbook/growthbook@^2.2.0 @growthbook/growthbook-react@^2.2.0

Create src/flags.ts. Here the feature value is a number, which lets the component use the same rendering code for either edition. A future change from four covers to three is one edit to the rule.

import type { LocalFeatures } from "@growthbook/growthbook";

export type Edition = "guest" | "subscriber";
type Features = { issueLimit: number };
type Attributes = { id: string; edition: Edition };

declare module "@growthbook/growthbook" {
  interface Register {
    features: Features;
    attributes: Attributes;
  }
}

export const features: LocalFeatures = {
  issueLimit: {
    defaultValue: 2,
    rules: [
      { condition: { edition: "subscriber" }, force: 4 },
    ],
  },
};

A guest falls through to the default of two. A subscriber matches the rule and gets four. This rule applies to every subscriber, so the ID has no effect on the result here. If you later roll the shelf out to a percentage of subscribers, you already have an identity to use for repeatable assignment.

The type registration release note explains the version requirement for LocalFeatures. The registration connects the definition, the attributes, and the value returned by the hook. For the TypeScript mechanics, see Jeremy Dorn's Register pattern walkthrough.

Put the current reader above the shelf

Replace src/App.tsx with the component below. The edition switch is a local fixture so anyone reviewing the change can reproduce both states. In an existing app, take those two values from the active reader in your session layer.

import { useMemo, useState } from "react";
import { GrowthBook, GrowthBookProvider } from "@growthbook/growthbook-react";
import { features, type Edition } from "./flags";
import { IssueShelf } from "./IssueShelf";

export default function App() {
  const readerId = "reader-17";
  const [edition, setEdition] = useState<Edition>("guest");

  const gb = useMemo(() => new GrowthBook({
    attributes: { id: readerId, edition },
    defaultHashVersion: 2,
  }).initSync({ payload: { features } }), [readerId, edition]);

  return (
    <GrowthBookProvider growthbook={gb}>
      <main>
        <h1>Recent issues</h1>
        <p>Current edition: {edition}</p>
        <button onClick={() => setEdition(
          edition === "guest" ? "subscriber" : "guest"
        )}>
          Switch edition
        </button>
        <IssueShelf />
      </main>
    </GrowthBookProvider>
  );
}

The provider receives an instance initialized with the current reader and the checked-in rules. React can render the correct shelf on the first pass for that reader. If the app is still loading a session, decide what should occupy the shelf in the meantime. For this public list a two-cover guest view is reasonable. On a page where a switch would interrupt the reader, wait for the session before mounting the shelf.

Give your agent the React setup

Use the local flags guide to ask for a typed definition, a provider with the current reader, and a test that changes the edition.

Open the Agent Guide

The useMemo dependencies include the ID and the edition. If a reader subscribes while signed in, their ID can stay the same while their edition changes. Depending only on the ID would leave the old SDK instance in place. Passing a fresh object as the dependency on every render would create unnecessary instances. The example uses the two primitive values the rule setup actually needs.

Read the numeric flag where React renders the list

Create src/IssueShelf.tsx. Keep one stable ID per issue and let the component use the resolved value to select how many items to render.

import { useFeatureValue } from "@growthbook/growthbook-react";

const issues = [
  { id: "nov", title: "November · Print shops" },
  { id: "oct", title: "October · Bookbinders" },
  { id: "sep", title: "September · Type designers" },
  { id: "aug", title: "August · Paper mills" },
];

export function IssueShelf() {
  const limit = useFeatureValue("issueLimit", 2);

  return (
    <ul aria-label="Recent magazine issues">
      {issues.slice(0, limit).map(issue => (
        <li key={issue.id}>{issue.title}</li>
      ))}
    </ul>
  );
}

Keep the hook at the top of the component, inside the provider's subtree. The React SDK supplies the flag value through that provider. Calling a hook inside a click handler or inside the list loop would break the Rules of Hooks. Use the returned number in ordinary render logic.

There are two places you can see the number two in this implementation. The definition's defaultValue is what an ordinary guest gets through evaluation. The 2 passed to the hook is a fallback for a value the SDK can't supply. Giving them the same value makes the basic shelf a sensible fallback, but checking only the guest case would let a broken provider arrangement or missing definition go unnoticed. The subscriber case proves that the component actually received the rule.

The list keys identify magazine issues. Keep those keys independent of the flag. Switching from two covers to four should preserve the identity of the first two rows. There's also no need to remount the whole app with an edition-specific key. React preserves state according to component position and keys. For example, a search input outside the shelf shouldn't lose its text because someone subscribed.

Check the transition in both directions

Use the template's build script to type-check and bundle the app. Once that passes, start the dev server and open the local address it prints.

npm run build
npm run dev

On first load, the page says guest and lists November and October. Click Switch edition. The same page should say subscriber and add September and August. Click again. The list should return to the original two issues, in order. This last check catches code that appends more results on upgrade and never removes them on downgrade.

For a compile-time check, temporarily replace the numeric fallback with the string "2". Run the build again and inspect the error on the hook call. Then restore 2 and rebuild. If the string compiles, check that src/flags.ts belongs to the same TypeScript project as the component and that the package manager resolved compatible core and React versions.

npm ls @growthbook/growthbook @growthbook/growthbook-react

Look for the core package used by your app and by the wrapper. If the app has several incompatible installations, align the versions before diagnosing the JSX. A team using an existing build script should also confirm it actually runs the TypeScript checker.

Hand off a React change someone can review

Give your coding agent the one-shot local feature flags guide and a short description of the observable behavior. For this shelf, the request can be as specific as the test.

Show two public issues to guests and four to subscribers.
Keep the same reader ID when switching editions in the test.
Report the initial titles, the titles after upgrading, and the titles
after switching back. Include the type-check command you ran.

The shelf controls how many public titles to display. If your actual feature unlocks paid articles, enforce access when the server serves an article. A client-rendered flag only decides what to show in that browser. Whenever a change to the display limit can wait for a deployment, the small local file keeps the decision reviewable alongside the component. When an editor needs to change it between issues without an engineering release, compare the free GrowthBook options for managing flag rules.

Manage the shelf in GrowthBook

Start a GrowthBook workspace when your magazine team is ready to manage shelf rules between deployments.

Get Started with GrowthBook
Feature Flags
Experiments

Use local feature flags per request in Node.js

Nov 20, 2026
x
min read

Two customers download the same weekly report. One has agreed to preview a new CSV column. The other feeds the old two-column format into an importer. Both requests can land on the same Node.js process, and each needs the right file even if the other request arrives while the report is loading.

This tutorial builds that endpoint with one checked-in feature flag. The process loads the rules once. Each request supplies its own workspace attributes and receives its own evaluation. You can run the whole example on your machine without an account, a client key, or a flag server. The free feature flags for coding agents walkthrough introduces the local approach. Here we'll give the agent a server-specific test to pass.

Set up a small TypeScript service

Use Node.js 22 or newer for this example. In an empty directory, create an npm project that uses ES modules, install the core SDK, and add the TypeScript tools.

npm init -y
npm pkg set type=module
npm install @growthbook/growthbook@^2.2.0
npm install -D typescript tsx @types/node@22

Create tsconfig.json at the project root. The sample runs TypeScript directly with tsx and checks types in a separate step. Type checking with tsx explains why the two commands serve different purposes.

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "strict": true,
    "noEmit": true,
    "skipLibCheck": true,
    "types": ["node"]
  },
  "include": ["*.ts"]
}

The following files all live next to that configuration. The server imports ./flags.js even though the source file is flags.ts. That spelling follows TypeScript's Node.js module resolution for ESM and works with this runner.

Define the report contract in one flag

Create flags.ts. The public format has two columns. The sample preview workspace gets one additional column. The only targeting attribute the rule needs today is reportPreview. Carry the workspace ID too, so two people downloading a report on behalf of the same workspace can share an assignment if you introduce a percentage rollout later.

import type { LocalFeatures } from "@growthbook/growthbook";

type Features = { includeUniqueReaders: boolean };
export type Workspace = { workspaceId: string; reportPreview: boolean };

declare module "@growthbook/growthbook" {
  interface Register {
    features: Features;
    attributes: Workspace;
  }
}

export const features: LocalFeatures = {
  includeUniqueReaders: {
    defaultValue: false,
    rules: [{ condition: { reportPreview: true }, force: true }],
  },
};

The SDK type registration update covers this rule syntax and the 2.2.0 minimum. If you misspell reportPreview in a condition or use a string where the boolean flag expects a value, TypeScript can point at the definition. The Register pattern also makes the same feature name available in other modules without threading a generic type through each handler.

Before you add the endpoint, decide what belongs to the process and what belongs to the request. The feature definitions are identical for both customers. Their identity and preview enrollment can differ. If a handler changes an attribute on a single shared user instance before awaiting a database query, another handler could replace that attribute before the first handler resumes.

Give your agent a server-side task

Use the one-shot guide to add checked-in rules. Ask your agent to keep workspace attributes local to each request and demonstrate both CSV formats.

Open the Local Flags Guide

Create a scope when the request arrives

Create server.ts. The Node.js SDK provides GrowthBookClient for the process and createScopedInstance for the current request. The two fixture paths below stand in for two authenticated workspaces. The server binds to the loopback address so you can exercise it locally.

import { createServer } from "node:http";
import { setTimeout as delay } from "node:timers/promises";
import { GrowthBookClient } from "@growthbook/growthbook";
import { features, type Workspace } from "./flags.js";

const client = new GrowthBookClient({ defaultHashVersion: 2 })
  .initSync({ payload: { features } });

const demos = new Map<string, Workspace>([
  ["/demo/preview", { workspaceId: "press-a", reportPreview: true }],
  ["/demo/standard", { workspaceId: "press-b", reportPreview: false }],
]);

createServer(async (req, res) => {
  const workspace = demos.get(req.url ?? "");
  if (req.method !== "GET" || !workspace) {
    res.writeHead(404).end();
    return;
  }

  const gb = client.createScopedInstance({ attributes: workspace });
  await delay(10); // Stand-in for loading this workspace's report.
  const expanded = gb.isOn("includeUniqueReaders");
  const csv = expanded
    ? "period,downloads,unique_readers\nweek-1,80,55\n"
    : "period,downloads\nweek-1,80\n";

  res.writeHead(200, {
    "Content-Type": "text/csv; charset=utf-8",
    "Cache-Control": "private, no-store",
  });
  res.end(csv);
}).listen(4178, "127.0.0.1", () => {
  console.log("Report server listening on http://127.0.0.1:4178");
});

The HTTP handler looks up a workspace, creates its scope, and holds that scope across an asynchronous operation. The short promise-based timer gives a second request time to arrive. In a real export, that's where the database or storage read would happen. Keep the stable client at module scope and the scoped instance inside the handler. If a formatter needs the decision, pass it the boolean or the scoped instance.

In production, resolve the workspace and its access rights from the authenticated session before reading the report. The two selectable paths here are fixtures for public sample data. A caller's choice of a header, query string, or workspace slug can't establish permission to read another customer's report. The endpoint also prevents shared response caching. If you cache real exports, the cache needs to distinguish the workspace and the report format, along with any other inputs that change the response.

Test two requests that overlap

In the first terminal, type-check the service and start it. A successful type check exits quietly. The next command prints the loopback address and keeps the server running.

npx tsc --noEmit
npx tsx server.ts

Save the following as verify.mjs. In a second terminal, run node verify.mjs. Node's built-in fetch calls the local server. Strict assertions compare the full header and data row, including where each row ends.

import assert from "node:assert/strict";

async function report(name) {
  const response = await fetch("http://127.0.0.1:4178/demo/" + name);
  assert.equal(response.status, 200);
  return response.text();
}

const [preview, standard, previewAgain] = await Promise.all([
  report("preview"), report("standard"), report("preview"),
]);

assert.equal(preview, "period,downloads,unique_readers\nweek-1,80,55\n");
assert.equal(standard, "period,downloads\nweek-1,80\n");
assert.equal(previewAgain, preview);
console.log("Both workspaces received the expected CSV.");

You should see the single success line. Testing just the preview workspace proves that the code can add a column. Testing both responses catches the more expensive mistake of silently changing an existing customer's export. Keeping the old format assertion around is especially valuable when the downstream importer belongs to someone outside your team.

To check the compile-time boundary, temporarily change gb.isOn("includeUniqueReaders") to gb.isOn("includeUniqueReader") and rerun npx tsc --noEmit. The diagnostic should identify the misspelled key. Restore it before running the server again. A coding agent can include the before-and-after type check and the two CSV headers in its pull request.

Decide when to expand the report

When one preview customer is ready, leave everyone else on the default. If the next step is to enroll a fraction of workspaces, choose an attribute that matches the promise you're making. Hashing a workspace ID lets colleagues downloading the same report share a format. Hashing each user's ID could give two analysts in the same company different column sets. The one-shot guide shows how to express a percentage and hash attribute in a local rule.

A new rule in flags.ts reaches a process through your deployment. During a rolling deploy, the same workspace might hit old and new processes. If customers need a durable choice of export schema, keep supporting the agreed format in the API itself. When the operational requirement is to change targeting between deploys, you can keep the scoped evaluation in the handler and change how the process receives its rules. The free GrowthBook offerings overview covers Cloud Starter and self-hosting for teams that want to manage those rules.

Manage report targeting in Cloud

Create a GrowthBook workspace when the team supporting exports needs to expand the preview independently of a server release.

Get Started with GrowthBook
Feature Flags
Experiments

Use local feature flags in the Next.js App Router

Nov 20, 2026
x
min read

Your conference agenda has a new “Show room” button. Reviewers should see it on the first page load. Everyone else should get the existing agenda. If a Server Component renders the old agenda and a browser hook independently decides to show the new button, the first HTML and the browser can disagree.

In the Next.js App Router, the server can make this decision once and pass a boolean to the interactive component. We'll define the flag in the repo, select the preview audience with a local test cookie, and verify the actual HTML for both visitors. Clicking the button will still work after hydration. You can follow along without a GrowthBook account or client key. If you're assigning this work to an agent, the free feature flags for coding agents walkthrough gives the background.

Keep the flag definitions on the server

Use a TypeScript App Router project, or create a small one with create-next-app. These paths assume the project has an app directory at its root. If yours uses src/app, put both app and lib under src so the relative imports still match.

npx create-next-app@latest agenda-flags --ts --app --empty --use-npm --no-src-dir --no-tailwind --yes
cd agenda-flags
npm install @growthbook/growthbook@^2.2.0 server-only

Keep the starter's root layout. Create lib/agenda-flags.ts with the following code. The SDK type registration update explains how LocalFeatures checks the flag and its rule against the registered types. This setup requires version 2.2.0 or later.

import "server-only";
import { GrowthBookClient, type LocalFeatures } from "@growthbook/growthbook";

type Features = { agendaRoomDetails: boolean };
type Attributes = { audience: "preview" | "public" };

declare module "@growthbook/growthbook" {
  interface Register {
    features: Features;
    attributes: Attributes;
  }
}

const features: LocalFeatures = {
  agendaRoomDetails: {
    defaultValue: false,
    rules: [{ condition: { audience: "preview" }, force: true }],
  },
};

const client = new GrowthBookClient({ defaultHashVersion: 2 })
  .initSync({ payload: { features } });

export function showRoomDetails(audience: Attributes["audience"]) {
  const gb = client.createScopedInstance({ attributes: { audience } });
  return gb.isOn("agendaRoomDetails");
}

The module can reuse the client and rules across requests handled by the same process. It only holds the current visitor's audience inside the function call. Two requests can therefore use the same flag file and get different results. The Node.js SDK documents the scoped client used under the App Router here.

This particular rule has no percentage and needs no visitor ID. The two audiences are sufficient. If the team later asks for a rollout to 10% of attendees, add a stable attendee or registration ID and choose which of those units should stay together. Jeremy Dorn's Register pattern article explains how a change to an attribute type reaches the call sites that construct it.

Read the cookie for this request

Create app/agenda/page.tsx. The static heading can render for everyone. The request-specific content sits behind a Suspense boundary, so the fallback can show a neutral loading message until the server has the cookie.

import { Suspense } from "react";
import { cookies } from "next/headers";
import { showRoomDetails } from "../../lib/agenda-flags";
import { Agenda } from "./Agenda";

async function AgendaForVisitor() {
  const jar = await cookies();
  const audience = jar.get("agenda-preview")?.value === "1"
    ? "preview"
    : "public";

  return <Agenda showRoom={showRoomDetails(audience)} />;
}

export default function AgendaPage() {
  return (
    <main>
      <h1>Conference agenda</h1>
      <Suspense fallback={<p>Loading the agenda…</p>}>
        <AgendaForVisitor />
      </Suspense>
    </main>
  );
}

The App Router's cookies function reads the incoming request asynchronously. Read it inside the visitor-specific component. Keeping that read out of shared cached code lets the surrounding page reuse common content without treating one visitor's decision as another's. This placement also accommodates App Router projects using Cache Components.

Give your agent the Next.js setup

Use the local flags guide with a concrete request to evaluate one flag on the server and return the same decision to the browser.

Open the Local Flags Guide

The cookie in this demo is a convenient way to preview a public UI treatment. Anyone with that cookie can see the room label. To target paying attendees or private sessions, obtain the audience from the verified session on the server and authorize the underlying data separately.

Pass one decision to the interactive component

Create app/agenda/Agenda.tsx. It's a Client Component because a visitor can open and close the room details. Its initial branch comes directly from the boolean supplied by the page.

"use client";

import { useState } from "react";

export function Agenda({ showRoom }: { showRoom: boolean }) {
  const [open, setOpen] = useState(false);

  return (
    <section data-agenda={showRoom ? "preview" : "standard"}>
      <h2>10:00 · Designing for print</h2>
      {showRoom && (
        <>
          <button aria-expanded={open} onClick={() => setOpen(!open)}>
            {open ? "Hide room" : "Show room"}
          </button>
          {open && <p>Room 204</p>}
        </>
      )}
    </section>
  );
}

The client boundary takes a serializable prop. The component receives true or false. The SDK instance, targeting rules, and cookie handling stay in the server module. You don't need a React provider for this component because its only browser-side choice is whether the visitor has clicked the button.

Follow one page load through server rendering and hydration. For a preview visitor, the server can send a section with a “Show room” button. React's first client render gets the same showRoom value and starts with open set to false. Hydration attaches the click handler. Opening the room detail then updates component state and doesn't require another flag evaluation.

Verify the HTML and the click separately

Build the production app and start it on port 3100.

npm run build
npm run start -- -p 3100

In a second terminal, save this as verify-agenda.mjs in the project root and run node verify-agenda.mjs. The test makes two requests to the same route and looks for a marker on the rendered section. A marker in the HTML helps catch an implementation that only adds the intended layout after JavaScript runs.

import assert from "node:assert/strict";

async function agenda(cookie) {
  const response = await fetch("http://localhost:3100/agenda", {
    headers: cookie ? { Cookie: cookie } : {},
  });
  assert.equal(response.status, 200);
  return response.text();
}

const [standard, preview] = await Promise.all([
  agenda(""), agenda("agenda-preview=1"),
]);
assert.match(standard, /<section data-agenda="standard"/);
assert.doesNotMatch(standard, /<section data-agenda="preview"/);
assert.match(preview, /<section data-agenda="preview"/);
assert.doesNotMatch(preview, /<section data-agenda="standard"/);
console.log("Both agenda layouts arrived in the server HTML.");

Now open http://localhost:3100/agenda in a fresh browser profile. You should see the session title without a room button. In that local page's browser console, set the demo cookie and reload.

document.cookie = "agenda-preview=1; Path=/; SameSite=Lax";
location.reload();

Click Show room and look for Room 204. Click Hide room and the room should disappear. This second check proves the component became interactive. If the server response test passes but the click fails, inspect the browser console for a hydration error before changing the flag rules.

Remove the fixture and reload once more. The button should disappear and the agenda title should remain.

document.cookie = "agenda-preview=; Path=/; Max-Age=0";
location.reload();

The reload is deliberate. Editing the cookie in an already open document doesn't rerun its Server Component. In your app, use the normal session-change flow to request a fresh server render when a visitor signs in, signs out, or leaves a preview group.

Choose where the next flag should be evaluated

For a decision needed in the initial HTML, give the agent an observable requirement. Ask it to show the two HTTP responses, then click the interactive control in the preview. The first check catches an incorrect layout. The second catches correct HTML that never becomes interactive.

If a later feature depends on an action entirely within the browser, evaluate whether its flag belongs in the client tree. The one-shot local flags guide covers both placements. This agenda only needs one server decision. Updating its checked-in rule takes a deployment. Keep that tradeoff in view if the event organizer needs to pause a preview while attendees are already arriving. For that case, compare GrowthBook’s free options for changing flags between deploys.

Manage the agenda rollout in Cloud

Create a GrowthBook workspace when the organizer needs to adjust a preview audience while your Next.js app is serving attendees.

Get Started with GrowthBook

Ready to ship faster?

No credit card required. Start with feature flags, experimentation, and product analytics—free.

Simplified white illustration of a right angle ruler or carpenter's square tool.White checkmark symbol with a scattered pixelated effect around its edges on a transparent background.