The flicker effect: why client-side tests look broken

PR opened → live

You have probably seen it as a user: a landing page loads, the headline reads one thing, and half a second later it jumps to something else. Buttons change color mid-glance. A section vanishes. Nothing crashed — you just watched a client-side A/B test apply itself after the page had already painted.

Practitioners call it the flicker effect, or FOOC — flash of original content. It is not a bug in any one tool; it is the architecture of client-side testing doing exactly what it must: the browser cannot rewrite a page it has not rendered, so the original always exists first.

What actually causes flicker

  1. The browser renders the original page. HTML arrives and paints. This is the version your server sent — the control.
  2. The testing script loads and initializes. It may also need a network round trip to fetch experiment config and assign the visitor.
  3. The DOM gets rewritten. The script swaps headlines, hides blocks, reorders sections. The visible jump between step 1 and step 3 is the flicker.

Everything that delays step 2 lengthens the flash: script size, network latency, a cold cache, a slow phone, a tag manager loading the tool late. On fast connections flicker might be tens of milliseconds; on a mid-range phone over cellular it can be a full second of the wrong page.

Why flicker is a measurement problem, not just a cosmetic one

The cosmetic damage is obvious — a page that visibly rearranges itself reads as janky, and on a landing page jank is indistinguishable from untrustworthiness. The subtler damage is to the experiment itself.

  • The variant group gets a worse experience by construction. Control users see a stable page. Variant users see a page that jumps. You are no longer measuring "design A vs design B"; you are measuring "stable A vs B-with-a-glitch", which systematically understates the variant's true effect.
  • The bias scales with slowness. Users on slow devices and networks see the longest flicker, so the penalty concentrates in specific segments — and quietly distorts any segment-level readout.
  • Early bounces contaminate assignment. Visitors who leave during the flash may bounce before the variant ever renders, yet they are counted as exposed to it.
  • A flat result stops meaning "no effect". It might mean the variant's genuine lift was cancelled by flicker's drag. You cannot tell from the data.
HTML arrives→Originalpaints→Test scriptloads→DOM rewritten→Variantvisible
Where the flash lives: the gap between first paint and the script's rewrite.

Anti-flicker snippets: the cure with side effects

The standard vendor fix is an anti-flicker snippet: a tiny inline script that hides the whole page (opacity zero, or a full-screen overlay) until the testing tool has applied its changes, with a timeout — typically a few seconds — after which the page reveals no matter what.

This works, in the sense that nobody sees the swap. But look at the trade: every visitor in the experiment now stares at a blank page for however long the tool takes to load. You removed a visual glitch by making the site slower for everyone, including the control group. Core Web Vitals feel it — perceived load time and Largest Contentful Paint absorb the hiding period — and if the script fails or times out, users waited on a blank screen to see the original page anyway.

The fixes that remove flicker at the source

Render the variant server-side

If the server decides the variant and renders it into the response, there is nothing to swap: the first paint is the variant. Flicker is not mitigated, it is structurally impossible. This is the approach that fits app frameworks anyway — in Next.js and other SSR stacks, client-side rewriting fights the framework's hydration, and server components make the server-rendered variant the natural path.

Or decide at the edge

For static or cached sites, an edge middleware can assign the visitor and serve the right pre-built version of the page before it reaches the browser — same guarantee, no origin render per request. We wrote about the caching mechanics in edge-cached experiment config.

The honest objection to both: someone has to write the variant as code rather than click it together in a visual editor. That is the actual trade-off behind flicker — vendor architectures accepted the flash so marketers would not need engineers. Trevo's answer is to keep the server-side architecture and remove the engineering bottleneck instead: it writes the variant code as a pull request you review, so the first paint is always the right paint and no anti-flicker snippet exists to slow anything down.

ApproachFlickerPage speed costWho builds variants
Client-side swap, no snippetVisible flashTesting scriptAnyone, visual editor
Client-side + anti-flickerHiddenBlank-page delay for allAnyone, visual editor
Edge assignmentNoneNegligibleEngineer (or Trevo PR)
Server-side renderNoneNegligibleEngineer (or Trevo PR)

Frequently asked questions

What is the flicker effect in A/B testing?

The flicker effect is the brief flash of the original page before a client-side testing script rewrites it into the variant. The browser must render the page before JavaScript can modify it, so variant users momentarily see the control. It looks like a glitch and biases measurement against the variant.

How do you prevent flicker in A/B tests?

Partially: load the testing script early and synchronously, inline critical config, and use an anti-flicker snippet that hides the page until changes apply. Completely: move the decision out of the browser — render variants server-side or assign them at the edge, so the first paint already shows the assigned version.

Do anti-flicker snippets hurt page speed?

Yes, by design. They hide the page — usually with a zero-opacity style or overlay — until the testing tool finishes, adding that wait to every experiment visitor's perceived load time and Largest Contentful Paint. The visual jump disappears, but the cost becomes a universal delay rather than an occasional flash.

Does flicker invalidate A/B test results?

It does not invalidate the randomization, but it contaminates the comparison: variant users experience the change plus a visual glitch that control users never see, which systematically drags the variant down. Strong effects can survive it; small ones can be masked entirely. Flat results from flickering tests are hard to interpret.