On this page
What this issue is
A/B testing tools change your page in the browser. If the original page shows first and the variant swaps in a moment later, visitors see a jump. This is called flicker.
To hide the jump, many tools ask you to add an anti-flicker snippet. It adds a CSS class to the <html> element that sets opacity: 0, then removes it when the tool is ready or when a timeout runs out. Google Optimize used a snippet called async-hide. Other tools, such as VWO, Optimizely, AB Tasty and Convert, have their own versions.
<style>.async-hide { opacity: 0 !important }</style>
<script>
(function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;
h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
(a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
})(window,document.documentElement,'async-hide','dataLayer',4000,{'GTM-XXXXXX':true});
</script>Why it costs you leads or sales
Visitors from ads decide fast. If they see a blank white page for a second or more, some leave before the form or buy button appears. You pay for that click and get nothing.
It also hurts your speed scores. A hidden hero delays LCP, which is one of Google's Core Web Vitals. Slow landing pages can lower the experience score on paid traffic and make every test run on a worse page than you think.
There is a second cost: the test itself. If the tool is slow or blocked (by an ad blocker or a network issue), the page stays hidden until the timeout. Every visitor in that situation waits for nothing.
- Click on adVisitor lands on the page
- HTML and CSS loadHero is ready to show
- Snippet hides pageopacity: 0 on the html element
- Hero visibleOnly after the tool loads or timeout
- Form or buy clickSome visitors have already left
The page is built quickly, but the snippet keeps it invisible until the testing tool answers or the timeout ends.
Example: illustrative numbers for one landing page on a mid-range phone. Your own values will differ.
How to check if your site has it
View the page source
Open your landing page, right-click and choose View page source. Search for
async-hide,opacity:0,opacity: 0 !important, or the name of your testing tool (vwo, optimizely, abtasty, convert).Look at the html element while loading
In Chrome DevTools, open the Network tab, set throttling to Slow 4G, reload, and watch the html element in the Elements tab. A class such as
async-hidethat disappears later is the snippet.Record a Performance trace
In the Performance tab, tick Screenshots and reload. If the screenshots show a blank page while the HTML is already parsed, the page is being hidden.
Check the LCP element
In the trace, open the Timings lane and click LCP. Compare its time with when the testing script finished loading.
Test with the tool blocked
Block the testing tool's domain in DevTools (Network request blocking) and reload. If the page stays blank until a fixed timeout, you have found a slow-tool risk.
How to fix it
Pick the option that fits your setup. Option 1 is best if you do not need to hide changes. Option 2 keeps testing but limits the damage.
| Option | What you do | Trade-off |
|---|---|---|
| Remove the snippet | Delete the hide style and script | Some visitors may see a brief flicker on test pages |
| Shorten the timeout | Change the timeout from 4000 ms to about 300-500 ms | Slow tool loads show the original page |
| Hide only the tested element | Hide a single selector, not the whole page | Needs a stable selector |
| Use server-side or edge testing | Choose the variant before the page is sent | Needs developer work or a tool that supports it |
Find the snippet
In Tags, look for a Custom HTML tag containing
async-hideor your tool's hide code. Check it is not also pasted in the theme.Edit or pause it
Lower the timeout value, or pause the tag and Preview to test. Fire it on All Pages only if you need it everywhere; limit it to pages in an active test.
Publish
Submit and publish a new container version with a clear name.
Find where it is added
Check Appearance > Theme File Editor (header.php), a header-scripts plugin such as WPCode, and your A/B testing plugin's settings.
Remove or edit
Delete the hide style and script, or lower the timeout number. Many tool plugins have a setting to turn off flicker protection.
Clear caches
Purge your caching plugin and any CDN cache so the old snippet is not served.
Search the theme
Go to Online Store > Themes > Edit code and open theme.liquid. Search for
async-hideandopacity.Check apps
Testing apps may add the snippet through app embeds. Open Customize > App embeds and look for your testing app.
Edit and save
Remove the hide code or reduce the timeout, then save and reload the product or landing page.
Open custom code
Go to Site settings > Custom code and check Head code. Also check page-level custom code in Page settings.
Edit
Remove the hide style and script, or lower the timeout, then publish the site.
Open custom code
Go to Settings > Custom code and find the head snippet from your testing tool.
Edit
Remove the hide part or shorten the timeout, then apply and publish.
Open code injection
Go to Settings > Advanced > Code Injection and check the Header box.
Edit
Remove the hide style and script or shorten the timeout, then save.
Check tracking code
In the funnel or website settings, open Settings > Tracking Code and look at the Head tracking code. Also check each page's own custom code.
Edit and republish
Remove the hide snippet or lower the timeout, then save and publish the funnel.
Hide only what you test
Replace the page-wide hide with a rule for one selector, and keep a short timeout.
Load the tool early
Place the testing script near the top of the head and add a preconnect to its domain.
<style>.fg-hide-hero { opacity: 0 !important }</style>
<script>
(function () {
var el = document.documentElement;
el.className += ' fg-hide-hero';
var done = function () { el.className = el.className.replace(/ ?fg-hide-hero/, ''); };
setTimeout(done, 400);
window.addEventListener('abtest-ready', done);
})();
</script>Before
- Whole page hidden until the tool loads
- Hero appears after a 4 s timeout if the tool is slow
- LCP tied to a third-party script
After
- Page visible straight away or after a very short wait
- Only the tested element is ever hidden
- LCP depends on your own hero image and CSS
How to confirm it's fixed
- View source no longer shows the page-wide hide style, or the timeout is short
- In a throttled Performance trace, the first screenshot already shows the hero
- Blocking the testing tool's domain does not leave the page blank
- LCP in PageSpeed Insights or Lighthouse is lower than before
- Active A/B tests still run and variants still appear
- The form, checkout or booking button still works on the test page
How to prevent it happening again
- Agree a maximum hide timeout (for example 400 ms) with whoever sets up tests
- Remove the snippet when a test ends and the tool is no longer used
- Keep one owner for head scripts so the snippet is not pasted in two places
- Run a speed check on a landing page after every new test tool or major test goes live
- Prefer server-side or edge testing for hero changes
0.0 s
Visitor arrives, snippet hides the page
0.8 s
Hero image and CSS are ready but invisible
2.0 s
Testing script is still loading on a weak mobile connection
4.0 s
Timeout ends and the page finally appears
Snippet on
Leads or data lost
The hero is invisible until the testing tool loads or the timeout ends. LCP is late and some visitors leave.
Example only: toggle the snippet to see how it changes what the visitor sees.
How FunnelGuard handles this
FunnelGuard detects this issue only partly. A robot visitor runs your real journey on a schedule and can see when a page is slow to show its main content, so an LCP delay on a funnel step is something it can pick up. It does not identify the anti-flicker snippet itself, so an alert will not say "your A/B testing snippet is hiding the page".
To cover the rest by hand, use the checks above: search the page source for the hide style, record a throttled Performance trace, and block the testing tool's domain to see whether the page stays blank. Do this whenever FunnelGuard reports a slow step on a page that runs A/B tests, and after you add or change a test.
FunnelGuard's Free plan covers 1 site and 2 journeys with daily checks and no card. Paid plans start at $39/month with a 3-day free trial.
Questions people ask
What is an anti-flicker snippet?
It is a small piece of code that makes the page invisible (usually with opacity: 0) until your A/B testing tool has applied its changes. It stops visitors seeing the original version jump into the variant. The cost is that the page stays hidden while the tool loads.
Why is my page blank for a few seconds before it shows?
If you run A/B tests, an anti-flicker snippet may be hiding the page until the testing script loads or a timeout of around 4 seconds ends. Check the page source for async-hide or opacity: 0 on the html element. A slow or blocked testing tool makes the blank period longer.
Does the anti-flicker snippet hurt LCP?
Yes, it can. The hero is hidden until the snippet releases the page, so Largest Contentful Paint is delayed by the wait for the testing tool or the timeout. Removing or shortening it usually brings LCP back toward the speed of your own page.
How do I remove the anti-flicker snippet?
Find where it was added: your theme header, Google Tag Manager, a code injection setting or the testing tool's plugin. Delete the hide style and script, or lower the timeout to a few hundred milliseconds, then clear caches and re-test. Make sure running tests still work.
What timeout should I use for an anti-flicker snippet?
Keep it short, around 300 to 500 milliseconds, rather than the common 4000. A short timeout limits how long visitors can be left with a blank page if the tool is slow. The trade-off is that a slow tool may show the original page instead of the variant.
Do I still need an anti-flicker snippet after Google Optimize shut down?
No, not for Optimize. Google Optimize ended in 2023, so an old async-hide snippet tied to it does nothing useful. Remove it. If you use another testing tool, check its own documentation on whether flicker protection is needed.
Can FunnelGuard tell me if an anti-flicker snippet is slowing my page?
Only partly. FunnelGuard can show an LCP delay on a funnel step, but it does not identify the snippet as the cause. You confirm the cause by checking the page source and a throttled performance trace by hand.
Related issues
- PRF-020Anti-flicker snippet timeout leaves page white for 4 s when tool is slowFix guide
- PRF-001LCP over 2.5 s on a funnel stepFix guide
- PRF-002LCP over 4 s on mobile (poor) on the paid landing pageFix guide
- PRF-012Render-blocking synchronous JS in <head> (jQuery, sliders)Fix guide
- PRF-016Client-side rendered page shows blank until JS bundle runsFix guide
- PRF-021Preloader / splash animation delays contentFix guide