Uncompressed Text Files
Priority: Critical
Impact: Negative
What issues it may cause
Uncompressed text-based resources contain unnecessary whitespace, comments, and other characters that inflate their file size. Larger file sizes require more bandwidth to transfer over the network and can result in longer download times, especially for users on slower network connections or devices with limited bandwidth.
Uncompressed JavaScript and CSS files can be render-blocking, meaning the browser must download and execute them before it can render the visible parts of the page.
Hosting larger text-based resources consumes more server resources and bandwidth, resulting in higher hosting costs. Additionally, increased bandwidth usage may lead to overage charges from web hosting providers.
Uncompressed text-based resources are also larger in size, and may lead to reduced efficiency of browser caching mechanisms. Cached resources may take up more storage space in the browser cache, leading to more frequent cache evictions and increased reliance on server requests for fetching resources.
How do you fix it
Enable text compression for text-based resources served by your web server. This can typically be done by enabling gzip or Brotli compression in your server configuration settings. Gzip and Brotli are widely supported compression algorithms that can significantly reduce the size of text-based resources without sacrificing quality.
If you are using a content delivery network (CDN), ensure that text compression is enabled at the CDN level as well to optimize the delivery of cached resources to users.
Regularly monitor and test your website's performance using tools like Lighthouse to identify any text compression issues and ensure that text-based resources are being compressed effectively.
Learn more about text compression.
What is the positive impact
Faster page load times and improved overall performance, leading to a better user experience and higher user satisfaction.
Reduced data transfer times and bandwidth usage, resulting in lower hosting costs and improved server efficiency.
Improved search engine rankings, as page speed is a factor considered by search engines when ranking websites in search results.
Enhanced accessibility for users on slower network connections or mobile devices, ensuring that they can access and interact with your website more efficiently.
How to fetch the data for this report template
You will need to run a crawl for report template to generate report. When report has been generated and you have crawl id you can fetch data for the report using the following query:
- Query
- Variables
- cURL
query GetReportForCrawl($crawlId: ObjectID!, $reportTemplateCode: String!) {
getCrawl(id: $crawlId) {
reportsByCode(
input: {
reportTypeCodes: Basic
reportTemplateCodes: [$reportTemplateCode]
}
) {
rows {
nodes {
... on CrawlSiteSpeedAuditOpportunities {
opportunityDigest
element
title
auditId
exampleUrl
wastedKibAvg
urlCount
wastedKibSum
gaPageviewsSum
savingsScoreSum
}
}
}
}
}
}
{"crawlId":"TjAwNUNyYXdsNDAwMA","reportTemplateCode":"uses_text_compression_failed_items"}
curl -X POST -H "Content-Type: application/json" -H "apollographql-client-name: docs-example-client" -H "apollographql-client-version: 1.0.0" -H "x-auth-token: YOUR_API_SESSION_TOKEN" --data '{"query":"query GetReportForCrawl($crawlId: ObjectID!, $reportTemplateCode: String!) { getCrawl(id: $crawlId) { reportsByCode( input: { reportTypeCodes: Basic reportTemplateCodes: [$reportTemplateCode] } ) { rows { nodes { ... on CrawlSiteSpeedAuditOpportunities { opportunityDigest element title auditId exampleUrl wastedKibAvg urlCount wastedKibSum gaPageviewsSum savingsScoreSum } } } } } }","variables":{"crawlId":"TjAwNUNyYXdsNDAwMA","reportTemplateCode":"uses_text_compression_failed_items"}}' https://api.lumar.io/graphql