Last updated on
Delay scripts

In this Google PageSpeed Experiment, we’re testing W3 Total Cache’s Delay Scripts tool to understand its impact on website performance.

We want to find out exactly how this feature helps enhance page load times so we have set up two websites, a control website and an experimental website.

+14 Points

In this test, using the Delay Scripts feature alone added +14 points for a 26% increase on mobile devices to the Google PageSpeed Performance score! Read the documentation to learn how to use the Delay Scripts tool.

Upgrade to W3 Total Cache Pro and improve your PageSpeed Scores today!

Audit: Google Mobile PageSpeed Score
Before: 54.25.
After: 68.5

Control Website

For our control website, we created a brand new WordPress installation.  For this experiment we’re using the Twenty Twenty-Four WordPress theme, a live chat plugin, and three active code snippets that pull in a weather widget, custom chart and a Google Calendar.

The purpose of adding these plugins and snippets is to generate different JS files on the site. This will help us test the “Delay Scripts” tool when we set up our “Experimental Website”.

Control Website: https://wordpress-speed-test.com/042624-site1/

Experimental Website

We duplicated our Control Website onto a new sub-folder to create a new Experimental Website that mirrors the original one.

We also installed W3 Total Cache Pro, enabled the Delay Scripts tool and used it to delay these four scripts for 5 seconds:

– event-calendar
– https://www.gstatic.com/charts/loader.js
– livechatinc.com
– weatherwidget.io

delayed-scripts

Experimental Website: https://wordpress-speed-test.com/042624-site2/

Why We chose These Scripts To Delay

A strategic deferral of non-essential scripts helps improve Google PageSpeed scores and creates a more responsive and user-friendly website. Delaying scripts can significantly enhance website performance by optimizing load times and reducing the initial burden on the main thread. For the experiment we chose to delay following scripts because of their commonality and the fact that none are essential immediately upon page load:

  1. Live Chat – We chose the live chat script from livechatinc.com because it’s not essential immediately upon page load. Users don’t typically need access to the chat widget the moment they land on the page, so delaying its load allows the main content to appear faster, improving the initial user experience.
  2. Weather Widget – Similarly, the weather widget script from weatherwidget.io is not a critical part of the page’s core functionality. Since this information can be loaded a few seconds after the rest of the page, delaying the weather widget script ensures that essential content is prioritized, further enhancing load times and overall site performance.
  3. Google Calendar Script – We chose the Google Calendar script because although it may be essential for displaying upcoming events or schedules, but its immediate presence upon page load is not critical.
  4. Custom Chart Script – the custom chart script, while providing valuable data visualization, can be deferred to prioritize the loading of essential content.

By delaying these scripts, we optimize load times and ensure a smoother user experience, particularly during the critical moments of initial page load.

62% Decrease

In this test, the Delay Scripts feature displayed a 62% decrease in Time Third-Party Code Blocked The Main Thread For on mobile screens and 37.5% on larger screens in the Google PageSpeed score results! Read the documentation to learn how to use the Delay Scripts tool.

Upgrade to W3 Total Cache Pro and improve your PageSpeed Scores today!

Audit: Time Third-Party Code Blocked The Main Thread For
Before: 825 ms
After: 197.5 ms

Desktop Mobile

Performance

Performance score

Standard siteW3TC OptimizedDifference
94.2597.75 +3.5 +3.71%

Points per Metrics

First Contentful Paint

Standard siteW3TC OptimizedDifference
10 points10 points 0 points 0%
No change.

Largest Contentful Paint

Standard siteW3TC OptimizedDifference
21.25 points23 points +1.75 points +8.24%

Total Blocking Time

Standard siteW3TC OptimizedDifference
30 points30 points 0 points 0%
No change.

Cumulative Layout Shift

Standard siteW3TC OptimizedDifference
25 points25 points 0 points 0%
No change.

Speed Index

Standard siteW3TC OptimizedDifference
8.25 points10 points +1.75 points +21.21%

Metrics

First Contentful Paint

Standard siteW3TC OptimizedDifference
0.6 s0.58 s -0.02 s -4.17%

Largest Contentful Paint

Standard siteW3TC OptimizedDifference
1.35 s1.13 s -0.23 s -16.67%

Total Blocking Time

Standard siteW3TC OptimizedDifference
12.5 ms17.5 ms +5 ms +40%

Cumulative Layout Shift

Standard siteW3TC OptimizedDifference
0.020 -0.02 -94.03%

Speed Index

Standard siteW3TC OptimizedDifference
1.53 s0.98 s -0.55 s -36.07%

Diagnostics

Largest Contentful Paint element

Standard siteW3TC OptimizedDifference
1360 ms1120 ms -240 ms -17.65%

Potential savings from render-blocking resources

Standard siteW3TC OptimizedDifference
227.5 ms190 ms -37.5 ms -16.48%

Potential savings by serving images in next-gen format

Standard siteW3TC Optimized
Passed auditPassed audit

Time third-party code blocked the main thread for

Standard siteW3TC OptimizedDifference
40 ms25 ms -15 ms -37.5%

Potential savings from unused CSS

Standard siteW3TC OptimizedDifference
13 KiB13 KiB 0 KiB 0%
No change.

Potential savings from unused JavaScript

Standard siteW3TC OptimizedDifference
295 KiB96.25 KiB -198.75 KiB -67.37%

Potential savings if Minifying CSS

Standard siteW3TC OptimizedDifference
3 KiB3 KiB 0 KiB 0%
No change.

# of static assets without an effecient cache policy

Standard siteW3TC OptimizedDifference
3115 -16 -51.61%

JavaScript execution time

Standard siteW3TC OptimizedDifference
0.33 s0.15 s -0.18 s -53.85%

Main-thread work

Standard siteW3TC OptimizedDifference
0.90.43 -0.48 -52.78%

# of long main-thread tasks

Standard siteW3TC OptimizedDifference
1.671.33 -0.33 -20%

Initial server response time

Standard siteW3TC OptimizedDifference
477.5 ms227.5 ms -250 ms -52.36%

# of large layout shifts

Standard siteW3TC OptimizedDifference
61 -5 -83.33%

# of user timings

Standard siteW3TC Optimized
0Passed audit

# of animations found

Standard siteW3TC Optimized
0Passed audit

Network payload

Standard siteW3TC OptimizedDifference
1308.5 KiB762.75 KiB -545.75 KiB -41.71%

DOM size

Standard siteW3TC OptimizedDifference
593261.25 -331.75 -55.94%

# of chains found

Standard siteW3TC OptimizedDifference
1916 -3 -15.79%

Defer offscreen images

Standard siteW3TC Optimized
Passed auditPassed audit

Minify JavaScript

Standard siteW3TC Optimized
Passed auditPassed audit

Properly size images

Standard siteW3TC Optimized
Passed auditPassed audit

Efficiently encode images

Standard siteW3TC Optimized
Passed auditPassed audit

Enable text compression

Standard siteW3TC Optimized
Passed auditPassed audit

Preconnect to required origins

Standard siteW3TC Optimized
Passed auditPassed audit

Preload key requests

Standard siteW3TC OptimizedDifference
00 0
No change.

Preload Largest Contentful Paint image

Standard siteW3TC Optimized
Passed auditPassed audit

Avoid multiple page redirects

Standard siteW3TC Optimized
Passed auditPassed audit

Use video formats for animated content

Standard siteW3TC Optimized
Passed auditPassed audit

Remove duplicate modules in JavaScript bundles

Standard siteW3TC Optimized
Passed auditPassed audit

Avoid serving legacy JavaScript to modern browsers

Standard siteW3TC OptimizedDifference
00 0
No change.

Largest Contentful Paint image was not lazily loaded

Standard siteW3TC Optimized
Passed auditPassed audit

Avoids document.write()

Standard siteW3TC OptimizedDifference
00 0
No change.

Image elements have explicit width and height

Standard siteW3TC Optimized
Passed auditPassed audit

Has a <meta name="viewport"> tag with width or initial-scale

Standard siteW3TC Optimized
Passed auditPassed audit

Uses passive listeners to improve scrolling performance

Standard siteW3TC Optimized
0Passed audit

All text remains visible during webfont loads

Standard siteW3TC Optimized
Passed auditPassed audit

W3 Total Cache

You haven't seen fast until you've tried PRO

   Full Site CDN + Additional Caching Options
   Advanced Caching Statistics, Purge Logs and More

Everything you need to scale your WordPress Website and improve your PageSpeed.

Leave a Reply

Your email address will not be published. Required fields are marked *

W3 Total Cache logo

We Can Help Optimize Your Website

Optimize your site’s performance with our one-time premium services or ongoing monthly VIP support. View services

Got a Minute?

Your feedback helps us improve. Complete our customer survey now.

Partners

Bunny CDN Logo