Save 15% with code SAVE15

JavaScript Optimization

Defer, delay, and minify JavaScript with 28+ quick exclusion presets and per-page disable controls.

Last updated Feb 21, 2026

Overview

JavaScript is render-blocking by default. When a browser encounters a <script> tag, it stops parsing HTML, downloads the script, executes it, then resumes. BoostPro offers three strategies to reduce JavaScript's impact on page load: defer, delay, and minify.

All JavaScript optimization settings are located on the BoostPro → Advanced tab under the JavaScript Processing section.

Defer JavaScript

Adds the defer attribute to script tags. Deferred scripts download in parallel with HTML parsing but wait to execute until the HTML is fully parsed. Scripts still execute in their original order.

  • Default: Off
  • Badge: Advanced
  • Impact: Reduces render-blocking, improves First Contentful Paint (FCP)

Auto-excluded scripts

BoostPro never defers these scripts to prevent breakage:

  • jquery, jquery-core, jquery-migrate
  • wp-polyfill, wp-hooks
  • Scripts that already have defer or async
  • Inline scripts (no src attribute)
  • Module scripts (type="module")

Custom exclusions

If a specific script breaks when deferred, add its handle or URL pattern to the exclusion list, one per line:

slider-script
my-custom-plugin
analytics.js

Delay JavaScript

More aggressive than defer. Delayed scripts do not load at all until the user interacts with the page (scroll, click, tap, mousemove, or keypress). A 10-second fallback timer ensures bots and non-interactive sessions can still execute scripts.

  • Default: Off
  • Badge: Advanced
  • Impact: Dramatic improvement to LCP, FID, and TBT scores

Auto-excluded from delay

  • Scripts with type="module", type="importmap", or type="speculationrules"
  • JSON data scripts (application/json, application/ld+json)
  • Scripts with the data-boost-no-defer attribute

Delay modes

BoostPro supports two delay modes:

  • Exclusion mode (default): All scripts are delayed except those matching your exclusion patterns. Best for most sites where you want maximum performance and selectively protect critical scripts.
  • Inclusion mode: Only scripts matching your inclusion patterns are delayed. Everything else loads normally. Best when you want precise control and only want to delay specific heavy scripts.

Quick exclusion presets

BoostPro includes 28+ pre-configured patterns for popular services. Instead of manually figuring out which patterns to exclude, toggle presets for common tools:

  • Google Analytics, Google Tag Manager, Google Ads
  • Google reCAPTCHA, Google Maps
  • Facebook Pixel, Meta SDK
  • HubSpot, Hotjar, Intercom, Drift
  • And many more

Each preset adds the correct exclusion patterns automatically.

Important

Delay JavaScript can break features that need to run on page load: sliders, analytics tracking, consent managers, and form validation. Use the exclusion presets for known services and test thoroughly.

Minify JavaScript

Removes whitespace and comments from JavaScript files to reduce their size. The lowest-risk optimization of the three.

  • Default: Off
  • Badge: Advanced
  • Skips: Files already minified (.min.js) and external scripts
  • Smart caching: Only serves the minified version if it is at least 10% smaller than the original
  • Cache location:/wp-content/cache/boost-js/ (100MB limit, 30-day cleanup)

Custom exclusions

If a script has issues when minified, add its handle or URL pattern to the exclusion list:

my-custom-script
plugin-problematic-js

Defer vs. delay vs. minify

FeatureDeferDelayMinify
What it doesMoves execution after HTML parsingDelays execution until user interactionReduces file size by removing whitespace/comments
Risk levelMediumHighLow
Performance impactModerate (faster render)Significant (faster render + lower TBT)Moderate (smaller downloads)
When to useMost sites, after testingSites focused on Core Web VitalsAll sites (safe starting point)

Developer attribute

Add the data-boost-no-defer attribute to any script tag to exclude it from both defer and delay processing:

<script src="critical.js" data-boost-no-defer></script>

BoostPro will skip this script entirely.

Per-page disable

Defer, delay, and minify can each be disabled for specific pages via the Resource Manager. This is useful for pages with known script compatibility issues.

Tip

Start with minify (lowest risk), then add defer, then delay. Test each change before adding the next. Run PageSpeed tests after each change to measure the improvement.