Setting the Trigger Interaction for Delayed JavaScript Execution
The Ultimate Cache plugin includes a Delay JavaScript Execution feature under Script Manager settings. This helps improve your site’s loading performance by delaying the loading of JavaScript files until a user interacts with the page.
What Delayed JavaScript Execution Does
When enabled, this option prevents non-critical JavaScript from loading immediately. Instead, scripts are loaded only when the visitor takes an action such as scrolling, clicking, or tapping. This reduces initial page weight and speeds up rendering, improving metrics like Largest Contentful Paint (LCP) and Time to Interactive (TTI).
What Is Trigger Interaction?
The Trigger Interaction setting defines a time (in milliseconds) after which the plugin will automatically load all deferred JavaScript if the user doesn’t interact with the page. This ensures that essential scripts eventually load even if no action is taken.
Recommended Trigger Interaction Timing
We recommend setting the Trigger Interaction value between 2500–3000 ms (2.5 to 3 seconds) for most websites.
Setting the delay in this range achieves a good balance:
Gives enough time for the page to render quickly and improve PageSpeed Insights scores.
Ensures that critical JavaScript still loads for visitors who don’t interact.
Prevents issues where PageSpeed or Lighthouse tests see missing content or broken functionality.
If you set a value below 2000 ms, you may lose much of the performance benefit because scripts will load almost immediately.
If you set a value higher than 5000 ms, automated tests may detect incomplete page behavior, potentially reducing your scores.
Default Recommendation
For best results, set the Trigger Interaction to 3000 ms.
You can adjust higher or lower depending on your site’s specific needs and testing results.