This site is not affiliated with or endorsed by Vercel, Inc. Read the docs, then deploy or run each experiment yourself.
AI

A/B Landing Copy Lab

AI generates two headlines, sticky cookie buckets assign A/B, and Redis/memory tracks impressions and conversions.

Run this experiment yourself

Demos are not embedded on this site. Deploy a standalone copy on Vercel or run the experiment app locally.

Local development

cd apps/experiments/ab-landing-copy-lab
pnpm install
pnpm dev

Then open http://localhost:3010.

This is an experimental demo. Use it as a starting point for your own projects.

A/B Landing Copy Lab uses generateObject to create two headlines, assigns visitors to sticky cookie buckets (Set-Cookie), and records impression/conversion counters in Redis or memory. Missing AI keys return 503.

Features

  • Two headlines – A/B variants from a product topic.
  • Sticky cookie bucket – ab_landing_bucket via Set-Cookie.
  • Funnel counters – impressions + conversions with rates.
  • Honest 503 when AI is not configured.

Server Reference

POST /api/generate

{ "topic": "..." }

GET /api/assign

Returns { bucket, headline } and sets cookie when new.

POST /api/event

{ "bucket": "A", "type": "impression" }

GET /api/stats

Funnel totals + conversion rates.

StatusCause
503No AI provider (generate)
400Invalid event payload

Implementation Details

Generate

generateObject for headlines A and B.

Assign + measure

Cookie sticky bucket; Redis/memory counters.

Use Cases

  • Learn AI + cookie cohort composition.
  • Prototype landing copy experiments.

Limitations

  • Demo-scale counters; not a stats platform.
  • No significance testing.

Use in your project

Copy handlers from apps/experiments/ab-landing-copy-lab/.

Deployment

Deploy on Vercel

Local Development

cd apps/experiments/ab-landing-copy-lab
pnpm install
pnpm dev

Configuration

VariableRequiredPurpose
AI_GATEWAY_API_KEYYes (or OPENAI_API_KEY)Headline generation
UPSTASH_REDIS_REST_URL / TOKENNoDurable funnel stats

Vercel / Next.js Features Used

  • AI SDK generateObject
  • Cookies / Set-Cookie
  • Upstash Redis
  • Route Handlers

Next Steps

On this page