Can I code this? An A/B Testing Tool for My Website
Split traffic between two variants, track a conversion event, compare — that's genuinely the whole build for a single test on your own site, no enterprise feature-flagging platform required.
Build it
Effort: an eveningRunning cost: $0/mo to start
Why CanICodeThis says Build it
Randomly assigning a visitor to variant A or B, persisted in a cookie, is a well-documented pattern
Tracking a conversion event per variant is a simple counter
A results page comparing conversion rates with a basic significance check is bounded, achievable statistics
The parts that'll cause problems
Getting statistical significance genuinely right (avoiding false positives from checking results too early) takes real care beyond a raw percentage comparison
Running several simultaneous tests on the same page without them interfering needs a bit of careful design
Feature-flagging at organization scale is a different, deeper product than a single test
How I'd build this
frontend
Astro or Next.js
database
Turso (SQLite)
hosting
Cloudflare Pages
MVP scope
Random 50/50 variant assignment, persisted in a cookie
Conversion event tracking per variant
A results page with conversion rate and a basic significance check
Postpone to v2
Multiple simultaneous tests on one page
Sequential testing to avoid early-peek false positives
Multi-variant (not just A/B) testing
What it actually costs to build
AI agent — with a subscription (Claude Pro/Max, Cursor, etc.)
$0 marginal
AI agent — pay-per-use API, no subscription
$16–$27 one-time
Hosting, once it's running
$0/mo (free tier)
Domain name, if you want your own
~$12/yr
Existing tools solving a similar problem typically run $74–$74/mo — see how they compare below.
The build prompt
Build me a simple A/B testing tool for my own site: a script that randomly assigns visitors to variant A or B (persisted in a cookie), a tracking endpoint for conversion events, and a results page showing conversion rate per variant with a basic statistical significance check.