Unminified JS Files
Priority: Critical
Impact: Negative
What issues it may cause
Failure to minify JavaScript files can result in larger file sizes, leading to longer download times and slower page load speeds. This can negatively impact user experience, particularly for users on slower network connections or devices with limited bandwidth. Additionally, larger file sizes increase the load on servers and consume more network bandwidth, potentially leading to higher hosting costs and reduced server performance.
How do you fix it
Minify JavaScript files before deploying them to your website. Minification tools remove unnecessary whitespace, comments, and other characters from JavaScript files, reducing their size without affecting functionality. Popular minification tools include UglifyJS, Terser, and Google's Closure Compiler.
Automate the minification process as part of your build or deployment pipeline to ensure that JavaScript files are minified consistently and efficiently.
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.
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 GetReportStatForCrawl(
$crawlId: ObjectID!
$reportTemplateCode: String!
$after: String
) {
getReportStat(
input: {crawlId: $crawlId, reportTemplateCode: $reportTemplateCode}
) {
crawlSiteSpeedAuditOpportunities(after: $after, reportType: Basic) {
nodes {
opportunityDigest
element
title
auditId
exampleUrl
wastedKibAvg
urlCount
wastedKibSum
gaPageviewsSum
savingsScoreSum
}
totalCount
pageInfo {
endCursor
hasNextPage
}
}
}
}
{"crawlId":"TjAwNUNyYXdsNDAwMA","reportTemplateCode":"unminified_javascript_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 GetReportStatForCrawl( $crawlId: ObjectID! $reportTemplateCode: String! $after: String ) { getReportStat( input: {crawlId: $crawlId, reportTemplateCode: $reportTemplateCode} ) { crawlSiteSpeedAuditOpportunities(after: $after, reportType: Basic) { nodes { opportunityDigest element title auditId exampleUrl wastedKibAvg urlCount wastedKibSum gaPageviewsSum savingsScoreSum } totalCount pageInfo { endCursor hasNextPage } } } }","variables":{"crawlId":"TjAwNUNyYXdsNDAwMA","reportTemplateCode":"unminified_javascript_failed_items"}}' https://api.lumar.io/graphql