Skip to main content

JavaScript

Dotjuice → Page speed → JavaScript

What this tab controls

Minification and combining of local scripts, deferred loading, delayed loading until user interaction, and manual exclusions.

Settings

SettingDefaultWhat it does
Minify JavaScriptOnStrips comments and unnecessary whitespace from scripts. If minifying a particular script would risk breaking it, the plugin automatically falls back to serving it unminified rather than risk broken code.
Combine JavaScript FilesOffMerges eligible local scripts into a single file. jQuery, Elementor scripts, WordPress core scripts, payment processor scripts, and anything carrying page-specific data are automatically excluded and kept separate — see below.
Defer JavaScript LoadingOnAdds the browser's native defer behaviour to local scripts, so they download in the background and run only after the page's HTML has finished parsing, instead of blocking it.
Delay JavaScript Until User InteractionOffHolds external scripts back entirely until the visitor's first scroll, click, tap, or key press — see the warning below.
Additional Exclude Handles or FilenamesEmptyA comma-separated list of partial matches to exclude from combining, deferring, and delaying.

Already excluded automatically

You don't need to manually exclude these — the plugin recognises them and leaves them alone:

  • jQuery and jQuery Migrate
  • Elementor's own scripts
  • WordPress core scripts (block library, polyfills, translation files)
  • Any script with data attached via wp_localize_script() (this is how many plugins pass AJAX URLs and security tokens to their scripts — combining or delaying it would break that plugin)
  • Payment processor scripts (Stripe, PayPal, and similar) — these are never delayed, since checkout flows often depend on them being ready immediately
  • Detected webpack/module bundles, which can break if concatenated with unrelated code

⚠ Before enabling "Delay JavaScript Until User Interaction"

This is the most aggressive JavaScript setting and delivers the biggest gain in initial load speed, but it means anything relying on those scripts genuinely won't run until the visitor first interacts with the page — no scroll, click, or key press means no script execution. For most sites this is invisible (analytics, chat widgets, and marketing pixels don't need to fire in the first fraction of a second), but if you have a script that must run immediately for the page to work correctly, exclude it by handle or filename first, or test thoroughly before relying on this in production.

Excluding a script

Same approach as CSS: find the script's handle or filename using your browser's developer tools, then add it to Additional Exclude Handles or Filenames. Do this if a specific plugin's functionality stops working after combining or delaying is enabled.

A note on combining with page builders

If your site is built with Elementor or a similar builder, don't expect Combine JavaScript Files to reduce every script down to one file — builder and block scripts are deliberately excluded from combining to avoid runtime conflicts between JavaScript modules. This is intentional and keeps your site stable; the combining still helps for your theme's and simpler plugins' scripts.