⚡ Edge & CDN

A/B Test Traffic Splitter

Routes a configurable percentage of traffic to alternate origins. Logs split results to KV for analysis. No app changes required.

Split Traffic Between Origins Without Touching Your App

A Cloudflare Worker that routes a configurable percentage of requests to an alternate origin and logs split results to Cloudflare KV for analysis. Run A/B tests on any site without deploying new code to your app server.

What's Included

  • Cloudflare Worker with weighted random traffic routing
  • KV namespace integration for per-variant request counting
  • Sticky session support via cookie — users stay on the same variant
  • wrangler.toml with KV binding pre-configured
  • Companion analytics query script to read KV results
  • README with full configuration and analysis workflow

How It Works

On each request, the Worker reads a sticky session cookie. If none exists, it randomly assigns the visitor to variant A or B based on your configured split percentage. The variant is stored in a cookie and the request is proxied to the appropriate origin. Every request increments a counter in KV, which you can query at any time.

What You Get

  • Zero-infrastructure A/B testing at Cloudflare's edge
  • Configurable split: send 10%, 50%, 90% of traffic to the new origin
  • Visitor-sticky sessions so the same user always sees the same variant
  • Real-time counters in Cloudflare KV — no third-party analytics required
  • Drop-in deployment to any existing Cloudflare route

Requirements

  • Cloudflare account (Workers Paid plan recommended for high traffic)
  • Two origin URLs to split between
  • Wrangler CLI installed (npm install -g wrangler)
$9.00
  • Instant download after purchase
  • Link valid for 48 hours
  • Up to 3 downloads per license
  • Secure, private delivery
Payments secured by Stripe