The brief
A B2B software company was migrating off WordPress. They wanted three things: faster load times, a CMS the marketing team would actually use, and a platform for running A/B tests without engineering involvement.
The stack
- Astro for the storefront — partially hydrated, lots of static HTML, very little JavaScript.
- Sanity as the headless CMS — the marketing team loved the editor experience after we customised it for their content types.
- Cloudflare Pages for hosting, with Workers handling A/B variant assignment and personalisation.
- R2 for media storage, fronted by Cloudflare's image transformation pipeline.
The A/B testing system
We built a lightweight A/B testing system using Cloudflare Workers. On first visit, the Worker assigns a variant and sets a cookie. Subsequent visits read the cookie. Variants are defined as Sanity documents — marketers can launch new tests by duplicating a page and selecting which sections to vary.
Crucially, the variant assignment happens at the edge, so the page renders the correct variant on the first byte. No flicker, no client-side JavaScript hiding-and-revealing content.
The outcome
- Lighthouse Performance score: 98 (mobile), 100 (desktop).
- TTFB: 90ms globally.
- Page-load time improved by 4.1 seconds (median session).
- Marketing publishes new pages in hours instead of days.
- Three A/B tests ran in the first month — all set up by marketing without engineering involvement.
The thing the client mentioned most often wasn't the performance number. It was that "the marketing team likes the CMS." We hear that almost every time we ship a headless build. The marketers' enthusiasm for the tooling tends to drive the cadence of content updates, which in turn drives the long-term ROI on the build.