TinySplits is a tiny, modular A/B experiment runner. Define experiments as self-contained modules with their own HTML, CSS, and tracking. Your client loads one script — zero config on their end.
<!-- That's it. One line. --> <script src="https://cdn.example.com/tinysplits.js"></script>
Each experiment is a single file with its own HTML, CSS, and tracking logic — completely self-contained and independently toggleable.
?preview=test.
No PostHog setup needed during development.
TinySplits runs through a validation pipeline before executing each experiment. No wasted PostHog calls, no unnecessary DOM lookups.
Create an experiment, register it, build. That's the entire workflow.
src/experiments/.
Define your PostHog key, target, styles, HTML, and run logic — all in one file.
Here's a real experiment that injects a promo banner with its own styles, HTML template, and click tracking — all in a single file.
import { defineExperiment } from '../core/types'; const styles = ` .ts-promo { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: white; padding: 14px 20px; border-radius: 8px; display: flex; justify-content: space-between; } `; const html = ` <div class="ts-promo"> <span>🚀 Get 20% off today!</span> <button class="ts-promo__cta">Claim Now</button> </div> `; export default defineExperiment({ key: 'promo-banner-test', enabled: true, target: '.main-content', styles, urlMatch: '/pricing', run({ variant, injectHTML, trackEvent }) { if (variant === 'test') { const el = injectHTML('.main-content', html, 'beforebegin'); el?.querySelector('.ts-promo__cta')?.addEventListener('click', () => { trackEvent('promo_clicked', { page: 'pricing' }); }); } }, });
The experiment runner is loaded on this page. Click the button below to activate the test variant and see an experiment inject a component in real-time.
.demo-content below.
When the test variant is active, a promo banner will be injected above it.
.demo-content target element.
The experiment will inject its banner above this area.
Get started with TinySplits in minutes. It's open source, free, and ridiculously small.