On this page
What this issue is
Many sites and apps embed data straight into the HTML so scripts can use it without another request. You see it as <script type="application/json">, window.__INITIAL_STATE__ = {...}, or <script id="__NEXT_DATA__"> on Next.js sites. Page builders, theme settings, product catalogues and tracking setups can all add one.
It becomes a problem when the blob is large (hundreds of KB or more) and the HTML response is not compressed with gzip or Brotli. JSON is repetitive text and usually shrinks a lot when compressed, so sending it raw wastes bandwidth.
Why it costs you leads or sales
The browser must download the whole HTML document before it can finish parsing it. A heavy document delays first paint and the point where forms and buttons work. The effect is mostly felt on mobile and slow networks. The business impact is usually low, but it adds to other weight problems on the same page.
- Request pageBrowser asks for the HTML
- Download HTML + JSONLarge uncompressed document
- Parse and renderStarts late
- Form or button usableVisitor may leave first
A large inline blob slows the first step, so every later step starts late.
Example: a 900 KB HTML document with inline JSON often shrinks to a fraction of that with Brotli or gzip. Your numbers will differ.
How to check if your site has it
Open DevTools Network
In Chrome press F12, open the Network tab, reload the page and click the first request (the document).
Compare size and transferred
In the Size column, the top number is transferred over the network and the bottom is the uncompressed size. If both are about equal and large, the HTML is not compressed.
Check the response headers
Look for a
content-encodingheader withgziporbr. If it is missing, compression is off.Find the blob
Open View Source and search for
application/json,__NEXT_DATA__,__INITIAL_STATE__orwindow.. Note which script tag is biggest.
curl -s -o /dev/null -D - -H 'Accept-Encoding: br, gzip' https://example.com/ | grep -i content-encoding
# Compare sizes
curl -s https://example.com/ | wc -c
curl -s -H 'Accept-Encoding: gzip' https://example.com/ | wc -cHow to fix it
There are two levers: compress what you send, and send less. Do compression first because it is quick.
Turn on compression
Many hosts and caching plugins have a gzip or Brotli setting. Check your host panel or your caching plugin's settings, or ask your host.
Find the plugin adding the data
Disable plugins one at a time on a staging site and re-check the HTML size. Page builders and product or map plugins are common sources.
Compression is handled for you
Shopify serves compressed HTML by default, so focus on the data size.
Trim Liquid output
If your theme prints a whole
productsorcollectionobject with| json, output only the fields you use. Remove apps that inject large JSON blocks.
Compression is handled for you
Webflow hosting serves compressed responses. Reduce what you embed.
Remove oversized custom embeds
Check Embed elements and custom code in Site settings for large inline data and move it to a separate file or a smaller set.
Enable Brotli or gzip for HTML
Add
text/htmlto the compressed types on your server or CDN. Examples are below.Send only needed fields
Serialise only the fields the first screen uses. Fetch the rest from an API after load.
Defer non-critical data
Load lists, filters or large catalogues with
fetch()when the user needs them.
gzip on;
gzip_comp_level 5;
gzip_min_length 1024;
gzip_types text/html application/json application/javascript text/css image/svg+xml;<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html application/json application/javascript text/css
</IfModule>How to confirm it's fixed
- The document response has
content-encoding: brorgzip. - Transferred size of the HTML is much smaller than its uncompressed size.
- The biggest inline script tag is smaller, or gone.
- The page still works: forms, buttons, filters and tracking behave as before.
- Test on a throttled mobile connection in DevTools (Network > Throttling).
How to prevent it happening again
- Keep compression on for text types at the server or CDN level.
- Review the HTML size after installing plugins, apps or theme updates.
- Set a rough size budget for the HTML document and check it in releases.
- Avoid printing whole objects into the page; pick fields.
- Load large datasets on demand instead of on first load.
How FunnelGuard handles this
This is outside what FunnelGuard checks. FunnelGuard runs your customer journeys with a robot visitor and checks steps, tracking hits and lead delivery. It does not inspect HTML size, inline JSON or server compression. For this issue use a page speed or performance tool, such as Lighthouse or PageSpeed Insights, or a build-time bundle and size analyser. They report document size and compression.
If a heavy page ever makes a form or button stop working, a FunnelGuard journey check can show that the step failed. It will not tell you the cause is the JSON blob.
Questions people ask
Why is my HTML file so large?
Often because data is embedded inside it, such as an app state script, a product list or builder settings. Open View Source and look for large <script> tags. Inline CSS and SVG can also add weight.
Does inline JSON in HTML hurt performance?
It can. The browser must download the whole document before it finishes parsing, so a large blob delays rendering. It matters most on slow mobile networks and when the HTML is not compressed.
How do I check if my HTML is compressed?
Open DevTools, go to the Network tab, reload, and click the document request. Look for content-encoding: gzip or br in the response headers. You can also run curl -I -H 'Accept-Encoding: br, gzip' yoursite.com.
How do I reduce the size of __NEXT_DATA__?
Return only the props the page needs from getServerSideProps or getStaticProps. Strip unused fields and fetch large lists on the client after load. Make sure the server or CDN compresses the HTML.
Is gzip or Brotli better for HTML?
Brotli usually compresses text slightly better than gzip, and all current browsers support it. Gzip is still a good choice and is widely available. Either is far better than sending HTML uncompressed.
Should I move inline JSON to a separate file?
If the data is not needed for the first screen, yes. A separate file can be cached and loaded later. Small data needed immediately is fine inline.
Can FunnelGuard detect a large JSON payload in my HTML?
No. This is outside what FunnelGuard checks. Use a page speed tool such as Lighthouse or PageSpeed Insights, or a bundle size analyser, for document size and compression.
Related issues
- PRF-076Total page weight over 3 MB on a landing pageFix guide
- PRF-077Page weight jumped after a change (new unoptimised asset)Fix guide
- PRF-078More than 150 requests on one pageFix guide
- PRF-082Unminified JS/CSSFix guide
- PRF-083Third-party scripts make up over half the page weightFix guide
- PRF-089Mobile visitors downloading desktop-size assetsFix guide