Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Anti-flicker snippet hides your page: how to find and fix it

CNV-348High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

A/B test tools swap parts of your page after it loads. This can cause a flash of the original content before the variant appears. To hide that flash, many tools ask you to paste an anti-flicker snippet in the head of your page. It adds a CSS rule that makes the page invisible, for example opacity: 0 on the html element, and removes the rule once the test script has finished.

Why it costs you leads or sales

A hidden page cannot convert. Visitors who arrive from paid ads see a white or empty screen, or see the page but cannot read it, and they leave within seconds. Because the page technically loaded, many analytics tools still count a visit, so you see traffic with no conversions and no obvious error.

Even when the timeout works, a long one (some snippets use 4 seconds) delays what visitors see. That hurts perceived speed and Core Web Vitals such as Largest Contentful Paint (LCP), the time until the main content appears. Slow pages on mobile lose more visitors, and you pay for every ad click that lands on them.

How a failed test script blocks the funnel
  1. Ad clickVisitor lands on the page
  2. Hide rule addedSnippet sets the page to invisible
  3. Test script loadsBlocked, slow or errors out
  4. Page revealedNever happens or waits for the timeout
  5. Form or checkoutVisitor never sees it

The hide rule is added first and only the test script can remove it.

Visitors who still see the page, by wait timeExample numbers
Visitors who still see the page, by wait time (example)No hide rule: 100 % of visitors; 0.5 s timeout: 96 % of visitors; 2 s timeout: 88 % of visitors; 4 s timeout: 78 % of visitors03877100968878No hide rule0.5 s timeout2 s timeout4 s timeout% of visitors

Example: illustrative numbers showing how a longer hide timeout can lose more visitors before they see anything.

How to check if your site has it

Check for a stuck hide rule
  1. Look for the snippet in the source

    Open the page, right-click and choose View page source. Search for terms such as async-hide, anti-flicker, opacity:0 or the name of your test tool. It is usually a small inline script in the head.

  2. Block the test script on purpose

    Open browser DevTools, go to the Network tab, right-click the test tool's script request and choose Block request URL (the wording varies by browser). Reload and see how long the page stays hidden.

  3. Inspect the html element

    In the Elements tab, check whether the html or body tag has a hide class or an inline style such as opacity: 0 or visibility: hidden after the page has loaded.

  4. Test on a slow connection

    In DevTools Network, set throttling to Slow 4G and reload. Note how long you see a blank page. Also try with an ad blocker on.

  5. Check your speed report

    Run PageSpeed Insights on the landing page. A high LCP, or a hidden element at capture time, points to the snippet.

A visitor meets a hidden page

The hide rule waits for a script that never arrives.

How to fix it

You have two choices. The safest is to remove the anti-flicker snippet and accept a small amount of flicker, or fix flicker in the test tool's own settings. If you need to keep it, add a short timeout so the page always appears, even if the tool fails.

Hide rule with a safe timeout (generic pattern)html
<style>.fg-hide{opacity:0 !important}</style>
<script>
(function(){
  var d=document.documentElement;
  d.classList.add('fg-hide');
  function show(){d.classList.remove('fg-hide');}
  // Always reveal the page after 500 ms, whatever happens.
  setTimeout(show,500);
  // Your test tool should call this when it is ready.
  window.revealPage=show;
})();
</script>
Where to change the snippet
  1. Find the tag

    In your container, open Tags and look for the test tool's tag or a Custom HTML tag containing the hide style.

  2. Move or shorten it

    Hide scripts must run early, so a GTM-loaded snippet often arrives too late. Prefer the tool's own head snippet. If you keep it in GTM, use the earliest trigger and shorten the timeout.

  3. Preview and publish

    Use Preview mode, confirm the page shows with the script blocked, then publish.

General fix order
  1. Pause or end finished tests

    Old tests keep the snippet active. If no test is running on the page, remove the snippet entirely.

  2. Shorten the timeout

    Set it to the lowest value your tool allows, ideally under one second.

  3. Make sure the script loads reliably

    Fix console errors, and check that your consent tool or ad blockers do not stop the test script while the hide rule still runs.

  4. Use server-side or tool-native options

    If your tool offers server-side variants or its own flicker setting, use that instead of a page-wide hide.

Page behaviour with and without a fail-safe

Before

  • Hide rule has no timeout, or a long one
  • Blocked test script leaves a blank page
  • Ad clicks wasted, LCP high

After

  • Page always shows within a short timeout
  • Failed script means original page, not an empty one
  • Form and buttons reachable on every visit
Test script blocked: with and without a timeoutInteractive
No timeout on the hide rule

No timeout

Leads or data lost

The test script fails, the page stays invisible and visitors leave without seeing the form.

Toggle to see what a failed test script does to the visitor.

How to confirm it's fixed

Confirmation checks
  • With the test script blocked in DevTools, the page appears within about a second
  • No hide class or opacity: 0 remains on html or body after load
  • With an ad blocker on, the page and form are visible
  • The form submits and the button can be clicked
  • PageSpeed Insights shows an LCP no worse than before the test
  • Variants still show correctly when the script does load

How to prevent it happening again

Habits that stop it coming back
  • Remove the snippet when a test ends, do not just pause it
  • Keep one owner and a change log for test tool code
  • Always include a timeout in any hide rule
  • Retest the page with the script blocked after each tool or theme update
  • Do not load the hide snippet from a source that depends on consent unless the page works without it
  • Run tests on a few pages at a time so a failure has a small reach
How the problem often unfolds
  1. Week 1

    A test is set up and the anti-flicker snippet is added to the head.

  2. Week 3

    The test ends and the tool account is closed, but the snippet stays.

  3. Week 3 onward

    The script no longer loads, so visitors wait for the timeout or see nothing.

  4. Later

    Snippet is found and removed or given a short timeout.

How FunnelGuard handles this

FunnelGuard detects this today. A robot visitor loads your landing page on a schedule, from the EU or the US, and measures how the page loads, including Core Web Vitals. It also checks whether your key buttons and form fields are visible and clickable, so a page stuck behind a hide rule or a covered call to action shows up as a failed step.

If a check fails, FunnelGuard re-checks it from a second region before sending one alert by email, Slack, Teams, WhatsApp, webhook or PagerDuty, with a screenshot and a likely cause. It cannot tell you which test tool is responsible with certainty, so use the screenshot and the steps above to confirm. The Free plan covers 1 site and 2 journeys with daily checks and no card, and paid plans have a 3-day free trial.

Questions people ask

Why is my page blank because of an A/B testing tool?

Your tool probably added an anti-flicker snippet that hides the page until its script loads. If the script is blocked, slow or broken, the hide rule is never removed. Add a short timeout or remove the snippet.

What is an anti-flicker snippet?

It is a small piece of code, usually in the page head, that makes the page invisible with CSS until an A/B test tool has applied its changes. It prevents visitors seeing the original content flash before the variant.

How do I remove the anti-flicker snippet?

Find it in your theme, tag manager or custom code settings by searching for the hide class or your test tool's name, then delete it and clear caches. Remove it only when no active test on the page relies on it.

How long should an anti-flicker timeout be?

As short as your tool allows, ideally under one second. The timeout is the longest a visitor will see nothing, so every extra second costs visitors and slows Largest Contentful Paint.

Does an anti-flicker snippet hurt Core Web Vitals?

It can. Hiding the page delays when content becomes visible, which can raise Largest Contentful Paint. A long timeout or a failed script makes it worse.

How can I test what happens if my A/B test script fails?

Open DevTools, go to the Network tab, block the test tool's script URL and reload. If the page stays hidden for more than a moment, you need a timeout or to remove the snippet.

Can I still use A/B testing without an anti-flicker snippet?

Yes. You can accept a small flicker, use your tool's server-side or built-in options, or test elements below the fold where flicker is less visible.

How can I be alerted if my page gets hidden?

A synthetic monitor such as FunnelGuard loads the page on a schedule, measures page load and checks that key buttons are visible, then alerts you with a screenshot if a check fails.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: page load / CWV / covered CTA.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.