On this page
What this issue is
Rocket Loader is a Cloudflare setting that rewrites your page so JavaScript loads later, after the rest of the page. Other tools do the same thing under names like "delay JavaScript", "defer JS" or "JS optimisation" (for example in WP Rocket, LiteSpeed Cache or Autoptimize).
Why it costs you leads or sales
There are two kinds of damage. First, forms and buttons break: a submit does nothing, a validation script fails, or a checkout button never reacts. Those are lost leads and sales. Second, tracking breaks silently: the conversion happens but GA4, Google Ads or Meta never hear about it. Your reports undercount and ad platforms optimise on bad data.
- Ad clickVisitor lands on the page
- Page loadsLooks normal
- Scripts rewrittenRocket Loader delays or reorders JS
- Form submitHandler missing or fails
- Conversion tagNever fires
The page loads, but the form script is delayed and the submit fails, so every later step is lost.
Example: a site where delayed scripts stop the conversion tag firing on some visits.
How to check if your site has it
Look at the page source
View source and search for rocket-loader or type="text/rocketscript" (older versions) or script src values containing /cdn-cgi/scripts/. These show Rocket Loader is active.
Check the Cloudflare setting
In Cloudflare go to Speed > Optimization > Content Optimization and see if Rocket Loader is on.
Test in a private window
Open the page, open DevTools > Console, and submit the form. Look for errors such as "$ is not defined" or "Uncaught ReferenceError".
Check tags fire
In DevTools > Network, filter for collect, g/collect, tr or conversion. Submit the form and confirm the hits appear. Google Tag Assistant can also show whether tags fired.
Compare with the feature off
Turn Rocket Loader off (or add ?nocache style bypass rules if you use them) and repeat. If it works with it off, you have found the cause.
The visitor converts, but the delayed script never sends the hit.
How to fix it
You have two options. The safest is to turn the optimisation off for pages with forms, checkouts and tags. The more precise one is to leave it on and exclude only the scripts that break.
Exclude a script from Rocket Loader
Add data-cfasync="false" to the script tag, for example <script data-cfasync="false" src="/js/form.js"></script>. Put it on the form, consent and tag manager scripts.
Or turn it off in Cloudflare
Go to Speed > Optimization > Content Optimization and switch Rocket Loader off. You can also use a Configuration Rule to disable it only on URLs such as /contact* or /checkout*.
Purge the cache
In Caching > Configuration choose Purge Everything so visitors get the updated HTML.
Find the optimiser
Check your caching or speed plugin (WP Rocket, LiteSpeed Cache, Autoptimize, Perfmatters) for Delay JavaScript, Defer JS or Combine JS.
Exclude the broken scripts
Add your form plugin, jQuery, consent tool and tag manager scripts to the plugin's exclusion list. The setting is usually named something like Excluded JavaScript Files or Delay JS exclusions.
Clear caches
Clear the plugin cache and the Cloudflare cache, then retest.
Exclude the GTM snippet
Add data-cfasync="false" to the GTM script tag in your site code so it loads on time. Check that your tags use the right triggers.
Test in Preview
Use Preview mode and confirm the Container Loaded and form submit events appear and your tags fire.
Check Cloudflare in front
Shopify stores usually sit behind Shopify's own CDN. Rocket Loader only applies if you proxy the domain through your own Cloudflare. If you do, switch it off for the store.
Review speed apps
Check any speed optimisation app for a delay or defer scripts option and exclude checkout, tracking and form apps.
Check for a Cloudflare proxy
If your Webflow site's DNS is proxied by Cloudflare, disable Rocket Loader for the domain or add a Configuration Rule for form pages.
Add the attribute to custom code
In Project Settings > Custom Code, add data-cfasync="false" to your own script tags.
Check for a proxy
Wix handles its own delivery. Rocket Loader only applies if you added Cloudflare in front, so turn it off there if so.
Check for a proxy
If your domain is proxied through Cloudflare, turn Rocket Loader off. Add data-cfasync="false" to scripts you place in Code Injection.
Check custom domain setup
If a Cloudflare proxy sits in front of your funnel domain, turn Rocket Loader off for that domain and retest the form and tracking.
<script data-cfasync="false" src="https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXXX"></script>
<script data-cfasync="false" src="/js/form-handler.js"></script>Scripts delayed
- Form script loads late
- Submit does nothing or errors
- Conversion tags missing from Network tab
Scripts excluded
- Form script loads on time
- Submit works and shows thank-you
- Tag hits sent to ad and analytics platforms
How to confirm it's fixed
- Page source no longer shows Rocket Loader rewriting your key scripts
- The Console shows no script errors on page load
- A test form submission succeeds and the thank-you page appears
- The Network tab shows the expected GA4, Google Ads and Meta hits
- The test lead arrives in your inbox and CRM
- You tested on mobile as well as desktop
How to prevent it happening again
Treat speed settings as risky changes. Each time you enable Rocket Loader, Delay JavaScript or a new optimisation plugin, or install a plugin that changes script loading, run a full test of your forms and tags straight away. Keep a short list of scripts that must be excluded, and re-check it when you change themes, form tools or consent tools.
How FunnelGuard handles this
FunnelGuard detects this issue today. A robot visitor runs your real journeys on a schedule, such as filling in a lead form, and checks the tag and submit contracts: whether the form actually submits, and whether the tracking hits for GA4, Google Ads, Meta and other platforms are sent. If a script change stops a submit or a tag, the check fails.
Questions people ask
Why is my form not submitting after I enabled Rocket Loader?
Rocket Loader delays JavaScript until after the page loads. If your form handler or validation script is delayed or reordered, the submit button may do nothing. Add data-cfasync="false" to the form script or turn Rocket Loader off for that page.
Does Cloudflare Rocket Loader break Google Tag Manager?
It can. Rocket Loader may delay or reorder the GTM snippet and the scripts it loads, so tags fire late or not at all. Add data-cfasync="false" to the GTM script and test with GTM Preview mode.
How do I exclude a script from Rocket Loader?
Add the attribute data-cfasync="false" to the script tag, for example <script data-cfasync="false" src="/js/form.js"></script>. Rocket Loader then leaves that script alone. Purge your cache afterwards.
Should I turn Rocket Loader off?
If you have forms, checkouts or conversion tracking, it is safest to turn it off or exclude those pages and scripts. Rocket Loader can help speed on content pages, so a rule that only disables it on key pages is a good middle path.
Why are my Meta Pixel and Google Ads conversions missing after a speed change?
Delayed or combined JavaScript can stop tracking scripts from running before the visitor converts or leaves. Check the Network tab for the tag hits after a test submission. If they are missing, exclude the tracking scripts from the optimisation.
How do I know if Rocket Loader is active on my site?
Check Speed > Optimization > Content Optimization in Cloudflare. You can also view the page source and look for scripts served from /cdn-cgi/scripts/ or rewritten script types.
Does this affect WordPress delay JavaScript plugins too?
Yes. Options such as Delay JavaScript, Defer JS or Combine JS in plugins like WP Rocket or Autoptimize can cause the same problems. Use each plugin's exclusion list for your form, consent and tag scripts.
Related issues
- OPS-117Minification/combine breaking scriptsFix guide
- OPS-107CDN serving stale page after deployFix guide
- OPS-110Cached form nonce expired (form rejects submissions)Fix guide
- OPS-111Cache stripping UTM/gclid query paramsFix guide
- OPS-106reCAPTCHA keys wrong domain / expired (form can't submit)Fix guide
- OPS-100Cloudflare/WAF blocks real visitors (challenge loops)Fix guide